Alexandre Julliard : kernel32: Get rid of the support for 16-bit resources in 32-bit resource functions.

Alexandre Julliard julliard at winehq.org
Tue Dec 29 09:06:45 CST 2009


Module: wine
Branch: master
Commit: e49c54d288c825f0b668f896e81b3f80cafcb857
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e49c54d288c825f0b668f896e81b3f80cafcb857

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 28 20:27:50 2009 +0100

kernel32: Get rid of the support for 16-bit resources in 32-bit resource functions.

---

 dlls/kernel32/resource.c |   70 +--------------------------------------------
 1 files changed, 2 insertions(+), 68 deletions(-)

diff --git a/dlls/kernel32/resource.c b/dlls/kernel32/resource.c
index 76d2741..8d52397 100644
--- a/dlls/kernel32/resource.c
+++ b/dlls/kernel32/resource.c
@@ -32,7 +32,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winternl.h"
-#include "wine/winbase16.h"
 #include "wine/debug.h"
 #include "wine/exception.h"
 #include "wine/unicode.h"
@@ -90,40 +89,6 @@ static NTSTATUS get_res_nameW( LPCWSTR name, UNICODE_STRING *str )
     return STATUS_SUCCESS;
 }
 
-/* retrieve the resource names for the 16-bit FindResource function */
-static BOOL get_res_name_type_WtoA( LPCWSTR name, LPCWSTR type, LPSTR *nameA, LPSTR *typeA )
-{
-    *nameA = *typeA = NULL;
-
-    __TRY
-    {
-        if (HIWORD(name))
-        {
-            DWORD len = WideCharToMultiByte( CP_ACP, 0, name, -1, NULL, 0, NULL, NULL );
-            *nameA = HeapAlloc( GetProcessHeap(), 0, len );
-            if (*nameA) WideCharToMultiByte( CP_ACP, 0, name, -1, *nameA, len, NULL, NULL );
-        }
-        else *nameA = ULongToPtr(LOWORD(name));
-
-        if (HIWORD(type))
-        {
-            DWORD len = WideCharToMultiByte( CP_ACP, 0, type, -1, NULL, 0, NULL, NULL );
-            *typeA = HeapAlloc( GetProcessHeap(), 0, len );
-            if (*typeA) WideCharToMultiByte( CP_ACP, 0, type, -1, *typeA, len, NULL, NULL );
-        }
-        else *typeA = ULongToPtr(LOWORD(type));
-    }
-    __EXCEPT_PAGE_FAULT
-    {
-        if (HIWORD(*nameA)) HeapFree( GetProcessHeap(), 0, *nameA );
-        if (HIWORD(*typeA)) HeapFree( GetProcessHeap(), 0, *typeA );
-        SetLastError( ERROR_INVALID_PARAMETER );
-        return FALSE;
-    }
-    __ENDTRY
-    return TRUE;
-}
-
 /* implementation of FindResourceExA */
 static HRSRC find_resourceA( HMODULE hModule, LPCSTR type, LPCSTR name, WORD lang )
 {
@@ -198,10 +163,6 @@ HRSRC WINAPI FindResourceExA( HMODULE hModule, LPCSTR type, LPCSTR name, WORD la
     TRACE( "%p %s %s %04x\n", hModule, debugstr_a(type), debugstr_a(name), lang );
 
     if (!hModule) hModule = GetModuleHandleW(0);
-    else if (!HIWORD(hModule))
-    {
-        return HRSRC_32( FindResource16( HMODULE_16(hModule), name, type ) );
-    }
     return find_resourceA( hModule, type, name, lang );
 }
 
@@ -223,19 +184,6 @@ HRSRC WINAPI FindResourceExW( HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD
     TRACE( "%p %s %s %04x\n", hModule, debugstr_w(type), debugstr_w(name), lang );
 
     if (!hModule) hModule = GetModuleHandleW(0);
-    else if (!HIWORD(hModule))
-    {
-        LPSTR nameA, typeA;
-        HRSRC16 ret;
-
-        if (!get_res_name_type_WtoA( name, type, &nameA, &typeA )) return NULL;
-
-        ret = FindResource16( HMODULE_16(hModule), nameA, typeA );
-        if (HIWORD(nameA)) HeapFree( GetProcessHeap(), 0, nameA );
-        if (HIWORD(typeA)) HeapFree( GetProcessHeap(), 0, typeA );
-        return HRSRC_32(ret);
-    }
-
     return find_resourceW( hModule, type, name, lang );
 }
 
@@ -606,10 +554,6 @@ HGLOBAL WINAPI LoadResource( HINSTANCE hModule, HRSRC hRsrc )
 
     TRACE( "%p %p\n", hModule, hRsrc );
 
-    if (hModule && !HIWORD(hModule))
-        /* FIXME: should convert return to 32-bit resource */
-        return HGLOBAL_32( LoadResource16( HMODULE_16(hModule), HRSRC_16(hRsrc) ) );
-
     if (!hRsrc) return 0;
     if (!hModule) hModule = GetModuleHandleA( NULL );
     status = LdrAccessResource( hModule, (IMAGE_RESOURCE_DATA_ENTRY *)hRsrc, &ret, NULL );
@@ -623,13 +567,7 @@ HGLOBAL WINAPI LoadResource( HINSTANCE hModule, HRSRC hRsrc )
  */
 LPVOID WINAPI LockResource( HGLOBAL handle )
 {
-    TRACE("(%p)\n", handle );
-
-    if (HIWORD( handle ))  /* 32-bit memory handle */
-        return handle;
-
-    /* 16-bit memory handle */
-    return LockResource16( HGLOBAL_16(handle) );
+    return handle;
 }
 
 
@@ -638,8 +576,7 @@ LPVOID WINAPI LockResource( HGLOBAL handle )
  */
 BOOL WINAPI FreeResource( HGLOBAL handle )
 {
-    if (HIWORD(handle)) return 0; /* 32-bit memory handle: nothing to do */
-    return FreeResource16( HGLOBAL_16(handle) );
+    return 0;
 }
 
 
@@ -648,9 +585,6 @@ BOOL WINAPI FreeResource( HGLOBAL handle )
  */
 DWORD WINAPI SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
 {
-    if (hModule && !HIWORD(hModule))
-        return SizeofResource16( HMODULE_16(hModule), HRSRC_16(hRsrc) );
-
     if (!hRsrc) return 0;
     return ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->Size;
 }




More information about the wine-cvs mailing list