ImmReleaseContext only return true

r00t0 r00t0 at o2.pl
Fri Oct 6 10:56:34 CDT 2017


From: Tomasz Romański <  r00t0 at poczta.o2.pl >  Subject: ImmReleaseContext only return true  Date: Fri,  6 Oct 2017 17:53:47 +0200  Message-Id: <  20171006155347.3592-1-r00t0 at o2 >   diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c  index 3f8ad1868c..07d8b8f56d 100644  --- a/dlls/imm32/imm.c  +++ b/dlls/imm32/imm.c  @@ -1733,34 +1733,34 @@ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)  UINT WINAPI ImmGetDescriptionA(     HKL hKL, LPSTR lpszDescription, UINT uBufLen)  {  -  WCHAR *buf;  -  DWORD len;  +    WCHAR *buf;  +    DWORD len;   -  TRACE("%p %p %d\n", hKL, lpszDescription, uBufLen);  +    TRACE("%p %p %d\n", hKL, lpszDescription, uBufLen);   -  /* find out how many characters in the unicode buffer */  -  len = ImmGetDescriptionW( hKL, NULL, 0 );  -  if (!len)  -    return 0;  +    /* find out how many characters in the unicode buffer */  +    len = ImmGetDescriptionW( hKL, NULL, 0 );  +    if (!len)  +       return 0;   -  /* allocate a buffer of that size */  -  buf = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR) );  -  if( !buf )  -  return 0;  +    /* allocate a buffer of that size */  +    buf = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR) );  +    if( !buf )  +        return 0;   -  /* fetch the unicode buffer */  -  len = ImmGetDescriptionW( hKL, buf, len + 1 );  +    /* fetch the unicode buffer */  +    len = ImmGetDescriptionW( hKL, buf, len + 1 );   -  /* convert it back to ASCII */  -  len = WideCharToMultiByte( CP_ACP, 0, buf, len + 1,  +    /* convert it back to ASCII */  +    len = WideCharToMultiByte( CP_ACP, 0, buf, len + 1,                  lpszDescription, uBufLen, NULL, NULL );   -  HeapFree( GetProcessHeap(), 0, buf );  +    HeapFree( GetProcessHeap(), 0, buf );   -  if (len == 0)  -    return 0;  +    if (len == 0)  +        return 0;   -  return len - 1;  +    return len - 1;  }   /*****************************  @@ -1768,14 +1768,14 @@ UINT WINAPI ImmGetDescriptionA(    */  UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen)  {  -  static const WCHAR name[] = { 'W','i','n','e',' ','X','I','M',0 };  +    static const WCHAR name[] = { 'W','i','n','e',' ','X','I','M',0 };   -  FIXME("(%p, %p, %d): semi stub\n", hKL, lpszDescription, uBufLen);  +    FIXME("(%p, %p, %d): semi stub\n", hKL, lpszDescription, uBufLen);   -  if (!hKL) return 0;  -  if (!uBufLen) return lstrlenW( name );  -  lstrcpynW( lpszDescription, name, uBufLen );  -  return lstrlenW( lpszDescription );  +    if (!hKL) return 0;  +    if (!uBufLen) return lstrlenW( name );  +    lstrcpynW( lpszDescription, name, uBufLen );  +    return lstrlenW( lpszDescription );  }   /*****************************  @@ -1887,8 +1887,8 @@ UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen)    */  BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)  {  -  InputContextData *data = get_imc_data(hIMC);  -  static int i;  +    InputContextData *data = get_imc_data(hIMC);  +    static int i;        if (!data)           return FALSE;  @@ -1896,7 +1896,7 @@ BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)       TRACE("(%p): semi-stub\n", hIMC);        if (!i++)  -      FIXME("(%p): semi-stub\n", hIMC);  +        FIXME("(%p): semi-stub\n", hIMC);      return data->IMC.fOpen;  }  @@ -2007,25 +2007,25 @@ BOOL WINAPI ImmGetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)    */  UINT WINAPI ImmGetVirtualKey(HWND hWnd)  {  -  OSVERSIONINFOA version;  -  InputContextData *data = ImmGetContext( hWnd );  -  TRACE("%p\n", hWnd);  +    OSVERSIONINFOA version;  +    InputContextData *data = ImmGetContext( hWnd );  +    TRACE("%p\n", hWnd);   -  if ( data )  -      return data->lastVK;  +    if ( data )  +        return data->lastVK;   -  version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);  -  GetVersionExA( &version );  -  switch(version.dwPlatformId)  -  {  -  case VER_PLATFORM_WIN32_WINDOWS:  -      return VK_PROCESSKEY;  -  case VER_PLATFORM_WIN32_NT:  -      return 0;  -  default:  -      FIXME("%d not supported\n",version.dwPlatfor  -      return VK_PROCESSKEY;  -  }  +    version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);  +    GetVersionExA( &version );  +    switch(version.dwPlatformId)  +    {  +    case VER_PLATFORM_WIN32_WINDOWS:  +        return VK_PROCESSKEY;  +    case VER_PLATFORM_WIN32_NT:  +        return 0;  +    default:  +        FIXME("%d not supported\n",version.dwPlatfor  +        return VK_PROCESSKEY;  +    }  }   /*****************************  @@ -2254,13 +2254,8 @@ BOOL WINAPI ImmRegisterWordW(    */  BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)  {  -  static BOOL shown = FALSE;  -  -  if (!shown) {  -     FIXME("(%p, %p): stub\n", hWnd, hIMC);  -     shown = TRUE;  -  }  -  return TRUE;  +    TRACE("(%p, %p): stub\n", hWnd, hIMC);  +    return TRUE;  }   /*****************************  @@ -2668,9 +2663,9 @@ BOOL WINAPI ImmShowSoftKeyboard(HWND hSoftWnd, int nCmdShow)    */  BOOL WINAPI ImmSimulateHotKey(HWND hWnd, DWORD dwHotKeyID)  {  -  FIXME("(%p, %d): stub\n", hWnd, dwHotKeyID);  -  SetLastError(ERROR_CALL_NOT_IM  -  return FALSE;  +    FIXME("(%p, %d): stub\n", hWnd, dwHotKeyID);  +    SetLastError(ERROR_CALL_NOT_IM  +    return FALSE;  }   /*****************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20171006/7ce3497a/attachment.html>


More information about the wine-patches mailing list