| 1 | /* $Id: resource.cpp,v 1.18 2002-02-25 12:02:17 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Misc resource procedures
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
|---|
| 7 | * Copyright 1998 Patrick Haller
|
|---|
| 8 | *
|
|---|
| 9 | *
|
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 11 | *
|
|---|
| 12 | */
|
|---|
| 13 | #include <os2win.h>
|
|---|
| 14 | #include <unicode.h>
|
|---|
| 15 | #include <winimagebase.h>
|
|---|
| 16 | #include <winexebase.h>
|
|---|
| 17 | #include <windllbase.h>
|
|---|
| 18 | #include <custombuild.h>
|
|---|
| 19 |
|
|---|
| 20 | #define DBG_LOCALLOG DBG_resource
|
|---|
| 21 | #include "dbglocal.h"
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | static PFNFINDRESOURCEEXA pfnCustomFindResourceA = NULL;
|
|---|
| 25 | static PFNFINDRESOURCEEXW pfnCustomFindResourceW = NULL;
|
|---|
| 26 |
|
|---|
| 27 | //******************************************************************************
|
|---|
| 28 | //Called by custom Odin builds to hook FindReource(Ex)A/W calls
|
|---|
| 29 | //******************************************************************************
|
|---|
| 30 | BOOL WIN32API SetCustomFindResource(PFNFINDRESOURCEEXA pfnFindResourceA, PFNFINDRESOURCEEXW pfnFindResourceW)
|
|---|
| 31 | {
|
|---|
| 32 | pfnCustomFindResourceA = pfnFindResourceA;
|
|---|
| 33 | pfnCustomFindResourceW = pfnFindResourceW;
|
|---|
| 34 | return TRUE;
|
|---|
| 35 | }
|
|---|
| 36 | //******************************************************************************
|
|---|
| 37 | //lpszName = integer id (high word 0), else string (name or "#237")
|
|---|
| 38 | //Can lpszType contain a pointer to a default resource type name?
|
|---|
| 39 | //******************************************************************************
|
|---|
| 40 | HRSRC WIN32API FindResourceA(HINSTANCE hModule, LPCSTR lpszName, LPCSTR lpszType)
|
|---|
| 41 | {
|
|---|
| 42 | Win32ImageBase *module;
|
|---|
| 43 | WORD wLanguage = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
|
|---|
| 44 |
|
|---|
| 45 | if(pfnCustomFindResourceA) {
|
|---|
| 46 | pfnCustomFindResourceA(&hModule, (LPSTR *)&lpszName, (LPSTR *)&lpszType, &wLanguage);
|
|---|
| 47 | }
|
|---|
| 48 | module = Win32ImageBase::findModule(hModule);
|
|---|
| 49 | if(module == NULL) {
|
|---|
| 50 | dprintf(("FindResourceA Module %X not found (%x %d)", hModule, lpszName, lpszType));
|
|---|
| 51 | return(NULL);
|
|---|
| 52 | }
|
|---|
| 53 | return module->findResourceA(lpszName, (LPSTR)lpszType, wLanguage);
|
|---|
| 54 | }
|
|---|
| 55 | //******************************************************************************
|
|---|
| 56 | //******************************************************************************
|
|---|
| 57 | HRSRC WIN32API FindResourceW(HINSTANCE hModule, LPCWSTR lpszName,
|
|---|
| 58 | LPCWSTR lpszType)
|
|---|
| 59 | {
|
|---|
| 60 | Win32ImageBase *module;
|
|---|
| 61 | WORD wLanguage = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
|
|---|
| 62 |
|
|---|
| 63 | if(pfnCustomFindResourceW) {
|
|---|
| 64 | pfnCustomFindResourceW(&hModule, (LPWSTR *)&lpszName, (LPWSTR *)&lpszType, &wLanguage);
|
|---|
| 65 | }
|
|---|
| 66 | module = Win32ImageBase::findModule(hModule);
|
|---|
| 67 | if(module == NULL) {
|
|---|
| 68 | dprintf(("FindResourceW Module %X not found (%x %d)", hModule, lpszName, lpszType));
|
|---|
| 69 | return(NULL);
|
|---|
| 70 | }
|
|---|
| 71 | return module->findResourceW((LPWSTR)lpszName, (LPWSTR)lpszType, wLanguage);
|
|---|
| 72 | }
|
|---|
| 73 | /*****************************************************************************
|
|---|
| 74 | * Name : HRSRC WIN32API FindResourceExA
|
|---|
| 75 | * Purpose : The FindResourceExA function determines the location of the
|
|---|
| 76 | * resource with the specified type, name, and language in the
|
|---|
| 77 | * specified module.
|
|---|
| 78 | * Parameters: HMODULE hModule resource-module handle
|
|---|
| 79 | * LPCSTR lpType pointer to resource type
|
|---|
| 80 | * LPCSTR lpName pointer to resource name
|
|---|
| 81 | * WORD wLanguage resource language
|
|---|
| 82 | * Variables :
|
|---|
| 83 | * Result : If the function succeeds, the return value is a handle to the
|
|---|
| 84 | * specified resource's info block. To obtain a handle to the
|
|---|
| 85 | * resource, pass this handle to the LoadResource function.
|
|---|
| 86 | * If the function fails, the return value is NULL
|
|---|
| 87 | * Remark :
|
|---|
| 88 | * Status : fully implemented
|
|---|
| 89 | *
|
|---|
| 90 | * Author : SvL
|
|---|
| 91 | *****************************************************************************/
|
|---|
| 92 |
|
|---|
| 93 | HRSRC WIN32API FindResourceExA( HMODULE hModule, LPCSTR lpType,
|
|---|
| 94 | LPCSTR lpName, WORD wLanguage)
|
|---|
| 95 | {
|
|---|
| 96 | Win32ImageBase *module;
|
|---|
| 97 |
|
|---|
| 98 | if(pfnCustomFindResourceA) {
|
|---|
| 99 | pfnCustomFindResourceA(&hModule, (LPSTR *)&lpName, (LPSTR *)&lpType, &wLanguage);
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | module = Win32ImageBase::findModule(hModule);
|
|---|
| 103 | if(module == NULL) {
|
|---|
| 104 | dprintf(("FindResourceExA Module %X not found (%x %d)", hModule, lpName, lpType));
|
|---|
| 105 | return(NULL);
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | return module->findResourceA((LPSTR)lpName, (LPSTR)lpType, wLanguage);
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | /*****************************************************************************
|
|---|
| 112 | * Name : HRSRC WIN32API FindResourceExA
|
|---|
| 113 | * Purpose : The FindResourceExA function determines the location of the
|
|---|
| 114 | * resource with the specified type, name, and language in the
|
|---|
| 115 | * specified module.
|
|---|
| 116 | * Parameters: HMODULE hModule resource-module handle
|
|---|
| 117 | * LPCSTR lpType pointer to resource type
|
|---|
| 118 | * LPCSTR lpName pointer to resource name
|
|---|
| 119 | * WORD wLanguage resource language
|
|---|
| 120 | * Variables :
|
|---|
| 121 | * Result : If the function succeeds, the return value is a handle to the
|
|---|
| 122 | * specified resource's info block. To obtain a handle to the
|
|---|
| 123 | * resource, pass this handle to the LoadResource function.
|
|---|
| 124 | * If the function fails, the return value is NULL
|
|---|
| 125 | * Remark :
|
|---|
| 126 | * Status : fully implemented
|
|---|
| 127 | *
|
|---|
| 128 | * Author : SvL
|
|---|
| 129 | *****************************************************************************/
|
|---|
| 130 |
|
|---|
| 131 | HRSRC WIN32API FindResourceExW(HMODULE hModule, LPCWSTR lpType,
|
|---|
| 132 | LPCWSTR lpName, WORD wLanguage)
|
|---|
| 133 | {
|
|---|
| 134 | Win32ImageBase *module;
|
|---|
| 135 |
|
|---|
| 136 | if(pfnCustomFindResourceW) {
|
|---|
| 137 | pfnCustomFindResourceW(&hModule, (LPWSTR *)&lpName, (LPWSTR *)&lpType, &wLanguage);
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | module = Win32ImageBase::findModule(hModule);
|
|---|
| 141 | if(module == NULL) {
|
|---|
| 142 | dprintf(("FindResourceExW Module %X not found (%x %d)", hModule, lpName, lpType));
|
|---|
| 143 | return(NULL);
|
|---|
| 144 | }
|
|---|
| 145 | return module->findResourceW((LPWSTR)lpName, (LPWSTR)lpType, wLanguage);
|
|---|
| 146 | }
|
|---|
| 147 | //******************************************************************************
|
|---|
| 148 | //hRes returned by LoadResource
|
|---|
| 149 | //******************************************************************************
|
|---|
| 150 | PVOID WIN32API LockResource(HGLOBAL hRes)
|
|---|
| 151 | {
|
|---|
| 152 | return (PVOID)hRes;
|
|---|
| 153 | }
|
|---|
| 154 | //******************************************************************************
|
|---|
| 155 | //hRes == returned by FindResource(Ex) = PIMAGE_RESOURCE_DATA_ENTRY for resource
|
|---|
| 156 | //******************************************************************************
|
|---|
| 157 | HGLOBAL WIN32API LoadResource(HINSTANCE hModule, HRSRC hRes)
|
|---|
| 158 | {
|
|---|
| 159 | Win32ImageBase *module;
|
|---|
| 160 |
|
|---|
| 161 | /* @@@PH */
|
|---|
| 162 | if(HIWORD(hRes) == NULL) {
|
|---|
| 163 | dprintf(("ERROR: LoadResource %x: invalid hRes %x", hModule, hRes));
|
|---|
| 164 | return 0;
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | dprintf(("LoadResource %x %X\n", hModule, hRes));
|
|---|
| 168 | if(hModule == 0 || hModule == -1 || (WinExe && hModule == WinExe->getInstanceHandle())) {
|
|---|
| 169 | module = (Win32ImageBase *)WinExe;
|
|---|
| 170 | }
|
|---|
| 171 | else {
|
|---|
| 172 | module = (Win32ImageBase *)Win32DllBase::findModule(hModule);
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | return (HGLOBAL)module->getResourceAddr(hRes);
|
|---|
| 176 | }
|
|---|
| 177 | //******************************************************************************
|
|---|
| 178 | //hRes == returned by FindResource(Ex)
|
|---|
| 179 | //******************************************************************************
|
|---|
| 180 | DWORD WIN32API SizeofResource(HINSTANCE hModule, HRSRC hRes)
|
|---|
| 181 | {
|
|---|
| 182 | Win32ImageBase *module;
|
|---|
| 183 |
|
|---|
| 184 | if(hRes == NULL) {
|
|---|
| 185 | dprintf(("ERROR: SizeofResource %x: invalid hRes %x", hModule, hRes));
|
|---|
| 186 | return(0);
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | dprintf(("SizeofResource %x %x", hModule, hRes));
|
|---|
| 190 |
|
|---|
| 191 | if(hModule == 0 || hModule == -1 || (WinExe && hModule == WinExe->getInstanceHandle())) {
|
|---|
| 192 | module = (Win32ImageBase *)WinExe;
|
|---|
| 193 | }
|
|---|
| 194 | else {
|
|---|
| 195 | module = (Win32ImageBase *)Win32DllBase::findModule(hModule);
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 | return module->getResourceSize(hRes);
|
|---|
| 199 | }
|
|---|
| 200 | //******************************************************************************
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 | /**
|
|---|
| 205 | * The EnumResourceNames function searches a module for each
|
|---|
| 206 | * resource of the specified type and passes the name of each
|
|---|
| 207 | * resource it locates to an application-defined callback function
|
|---|
| 208 | *
|
|---|
| 209 | * @returns If the function succeeds, the return value is nonzero.
|
|---|
| 210 | * If the function fails, the return value is zero
|
|---|
| 211 | * @param hModule resource-module handling
|
|---|
| 212 | * @param lpszType pointer to resource type
|
|---|
| 213 | * @param lpEnumFunc pointer to callback function
|
|---|
| 214 | * @param lParam application-defined parameter
|
|---|
| 215 | * @status fully implemented
|
|---|
| 216 | * @author knut st. osmundsen
|
|---|
| 217 | * @remark The EnumResourceNames function continues to enumerate resource
|
|---|
| 218 | * names until the callback function returns FALSE or all resource
|
|---|
| 219 | * names have been enumerated
|
|---|
| 220 | */
|
|---|
| 221 | BOOL WIN32API EnumResourceNamesA(HINSTANCE hModule,
|
|---|
| 222 | LPCTSTR lpszType,
|
|---|
| 223 | ENUMRESNAMEPROCA lpEnumFunc,
|
|---|
| 224 | LONG lParam)
|
|---|
| 225 | {
|
|---|
| 226 | Win32ImageBase *pModule;
|
|---|
| 227 |
|
|---|
| 228 | dprintf(("KERNEL32:EnumResourceNamesA(%08x,%08x,%08x,%08x)",
|
|---|
| 229 | hModule, lpszType, lpEnumFunc, lParam
|
|---|
| 230 | ));
|
|---|
| 231 |
|
|---|
| 232 | pModule = Win32ImageBase::findModule(hModule);
|
|---|
| 233 | if (pModule == NULL)
|
|---|
| 234 | {
|
|---|
| 235 | SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); //todo: right error????
|
|---|
| 236 | return FALSE;
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | return pModule->enumResourceNamesA(hModule, lpszType, lpEnumFunc, lParam);
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 | /**
|
|---|
| 244 | * The EnumResourceNames function searches a module for each
|
|---|
| 245 | * resource of the specified type and passes the name of each
|
|---|
| 246 | * resource it locates to an application-defined callback function
|
|---|
| 247 | *
|
|---|
| 248 | * @returns If the function succeeds, the return value is nonzero.
|
|---|
| 249 | * If the function fails, the return value is zero
|
|---|
| 250 | * @param hModule resource-module handling
|
|---|
| 251 | * @param lpszType pointer to resource type
|
|---|
| 252 | * @param lpEnumFunc pointer to callback function
|
|---|
| 253 | * @param lParam application-defined parameter
|
|---|
| 254 | * @status fully implemented
|
|---|
| 255 | * @author knut st. osmundsen
|
|---|
| 256 | * @remark The EnumResourceNames function continues to enumerate resource
|
|---|
| 257 | * names until the callback function returns FALSE or all resource
|
|---|
| 258 | * names have been enumerated
|
|---|
| 259 | */
|
|---|
| 260 | BOOL WIN32API EnumResourceNamesW(HMODULE hModule,
|
|---|
| 261 | LPCWSTR lpszType,
|
|---|
| 262 | ENUMRESNAMEPROCW lpEnumFunc,
|
|---|
| 263 | LONG lParam)
|
|---|
| 264 | {
|
|---|
| 265 | Win32ImageBase *pModule;
|
|---|
| 266 |
|
|---|
| 267 | dprintf(("KERNEL32:EnumResourceNamesW(%08x,%08x,%08x,%08x)\n",
|
|---|
| 268 | hModule, lpszType, lpEnumFunc, lParam));
|
|---|
| 269 |
|
|---|
| 270 | pModule = Win32ImageBase::findModule(hModule);
|
|---|
| 271 | if (pModule == NULL)
|
|---|
| 272 | {
|
|---|
| 273 | SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); //todo: right error????
|
|---|
| 274 | return FALSE;
|
|---|
| 275 | }
|
|---|
| 276 |
|
|---|
| 277 | return pModule->enumResourceNamesW(hModule, lpszType, lpEnumFunc, lParam);
|
|---|
| 278 | }
|
|---|
| 279 |
|
|---|
| 280 | /*****************************************************************************
|
|---|
| 281 | * Name : BOOL WIN32API EnumResourceLanguagesA
|
|---|
| 282 | * Purpose : The EnumResourceLanguagesA function searches a module for each
|
|---|
| 283 | * resource of the specified type and name and passes the language
|
|---|
| 284 | * of each resource it locates to a defined callback function
|
|---|
| 285 | * Parameters: HMODULE hModule resource-module handle
|
|---|
| 286 | * LPCTSTR lpType pointer to resource type
|
|---|
| 287 | * LPCTSTR lpName, pointer to resource name
|
|---|
| 288 | * ENUMRESLANGPROC lpEnumFunc pointer to callback function
|
|---|
| 289 | * LONG lParam application-defined parameter
|
|---|
| 290 | * Variables :
|
|---|
| 291 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 292 | * If the function fails, the return value is zero.
|
|---|
| 293 | * Remark : The EnumResourceLanguages function continues to enumerate
|
|---|
| 294 | * resource languages until the callback function returns FALSE
|
|---|
| 295 | * or all resource languages have been enumerated.
|
|---|
| 296 | * Status : fully implemented
|
|---|
| 297 | *
|
|---|
| 298 | * Author : Markus Montkowski [Tha, 1998/05/21 17:46]
|
|---|
| 299 | *****************************************************************************/
|
|---|
| 300 |
|
|---|
| 301 | BOOL WIN32API EnumResourceLanguagesA(HMODULE hModule, LPCSTR lpType,
|
|---|
| 302 | LPCSTR lpName,
|
|---|
| 303 | ENUMRESLANGPROCA lpEnumFunc,
|
|---|
| 304 | LONG lParam)
|
|---|
| 305 | {
|
|---|
| 306 | Win32ImageBase *pModule;
|
|---|
| 307 |
|
|---|
| 308 | dprintf(("KERNEL32:EnumResourceLanguagesA(%08x,%08x,%08x,%08x,%08x)",
|
|---|
| 309 | hModule, lpType, lpName, lpEnumFunc, lParam));
|
|---|
| 310 |
|
|---|
| 311 | pModule = Win32ImageBase::findModule(hModule);
|
|---|
| 312 | if (pModule == NULL)
|
|---|
| 313 | {
|
|---|
| 314 | SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); //todo: right error????
|
|---|
| 315 | return FALSE;
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | return pModule->enumResourceLanguagesA(hModule, lpType, lpName, lpEnumFunc, lParam);
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | /*****************************************************************************
|
|---|
| 322 | * Name : BOOL WIN32API EnumResourceLanguagesW
|
|---|
| 323 | * Purpose : The EnumResourceLanguagesW function searches a module for each
|
|---|
| 324 | * resource of the specified type and name and passes the language
|
|---|
| 325 | * of each resource it locates to a defined callback function
|
|---|
| 326 | * Parameters: HMODULE hModule resource-module handle
|
|---|
| 327 | * LPCTSTR lpType pointer to resource type
|
|---|
| 328 | * LPCTSTR lpName, pointer to resource name
|
|---|
| 329 | * ENUMRESLANGPROC lpEnumFunc pointer to callback function
|
|---|
| 330 | * LONG lParam application-defined parameter
|
|---|
| 331 | * Variables :
|
|---|
| 332 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 333 | * If the function fails, the return value is zero.
|
|---|
| 334 | * Remark : The EnumResourceLanguages function continues to enumerate
|
|---|
| 335 | * resource languages until the callback function returns FALSE
|
|---|
| 336 | * or all resource languages have been enumerated.
|
|---|
| 337 | * Status : fully implemented
|
|---|
| 338 | *
|
|---|
| 339 | * Author : Markus Montkowski [Tha, 1998/05/21 17:46]
|
|---|
| 340 | *****************************************************************************/
|
|---|
| 341 |
|
|---|
| 342 | BOOL WIN32API EnumResourceLanguagesW(HMODULE hModule, LPCWSTR lpType,
|
|---|
| 343 | LPCWSTR lpName,
|
|---|
| 344 | ENUMRESLANGPROCW lpEnumFunc,
|
|---|
| 345 | LONG lParam)
|
|---|
| 346 | {
|
|---|
| 347 | Win32ImageBase *pModule;
|
|---|
| 348 |
|
|---|
| 349 | dprintf(("KERNEL32:EnumResourceLanguagesW(%08x,%08x,%08x,%08x,%08x)",
|
|---|
| 350 | hModule, lpType, lpName, lpEnumFunc, lParam));
|
|---|
| 351 |
|
|---|
| 352 | pModule = Win32ImageBase::findModule(hModule);
|
|---|
| 353 | if (pModule == NULL)
|
|---|
| 354 | {
|
|---|
| 355 | SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); //todo: right error????
|
|---|
| 356 | return FALSE;
|
|---|
| 357 | }
|
|---|
| 358 | return pModule->enumResourceLanguagesW(hModule, lpType, lpName, lpEnumFunc, lParam);
|
|---|
| 359 | }
|
|---|
| 360 |
|
|---|
| 361 | /*****************************************************************************
|
|---|
| 362 | * Name : BOOL WIN32API EnumResourceTypesA
|
|---|
| 363 | * Purpose : The EnumResourceTypesA function searches a module for resources
|
|---|
| 364 | * and passes each resource type it finds to an application-defined
|
|---|
| 365 | * callback function
|
|---|
| 366 | * Parameters: HMODULE hModule, resource-module handle
|
|---|
| 367 | * ENUMRESTYPEPROC lpEnumFunc pointer to callback function
|
|---|
| 368 | * LONG lParam application-defined parameter
|
|---|
| 369 | * Variables :
|
|---|
| 370 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 371 | * If the function fails, the return value is zero
|
|---|
| 372 | * Remark :
|
|---|
| 373 | * Status : fully implemented
|
|---|
| 374 | *
|
|---|
| 375 | * Author : Markus Montkowski [Tha, 1998/05/21 17:46]
|
|---|
| 376 | *****************************************************************************/
|
|---|
| 377 |
|
|---|
| 378 | BOOL WIN32API EnumResourceTypesA(HMODULE hModule,
|
|---|
| 379 | ENUMRESTYPEPROCA lpEnumFunc, LONG lParam)
|
|---|
| 380 | {
|
|---|
| 381 | Win32ImageBase *pModule;
|
|---|
| 382 |
|
|---|
| 383 | dprintf(("KERNEL32:EnumResourceTypesA(%08x,%08x,%08x)\n",
|
|---|
| 384 | hModule, lpEnumFunc, lParam));
|
|---|
| 385 |
|
|---|
| 386 | pModule = Win32ImageBase::findModule(hModule);
|
|---|
| 387 | if (pModule == NULL)
|
|---|
| 388 | {
|
|---|
| 389 | SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); //todo: right error????
|
|---|
| 390 | return FALSE;
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | return pModule->enumResourceTypesA(hModule, lpEnumFunc, lParam);
|
|---|
| 394 | }
|
|---|
| 395 |
|
|---|
| 396 | /*****************************************************************************
|
|---|
| 397 | * Name : BOOL WIN32API EnumResourceTypesW
|
|---|
| 398 | * Purpose : The EnumResourceTypesW function searches a module for resources
|
|---|
| 399 | * and passes each resource type it finds to an application-defined
|
|---|
| 400 | * callback function
|
|---|
| 401 | * Parameters: HMODULE hModule, resource-module handle
|
|---|
| 402 | * ENUMRESTYPEPROC lpEnumFunc pointer to callback function
|
|---|
| 403 | * LONG lParam application-defined parameter
|
|---|
| 404 | * Variables :
|
|---|
| 405 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 406 | * If the function fails, the return value is zero
|
|---|
| 407 | * Remark :
|
|---|
| 408 | * Status : fully implemented
|
|---|
| 409 | *
|
|---|
| 410 | * Author : Markus Montkowski [Tha, 1998/05/21 17:46]
|
|---|
| 411 | *****************************************************************************/
|
|---|
| 412 |
|
|---|
| 413 | BOOL WIN32API EnumResourceTypesW(HMODULE hModule,
|
|---|
| 414 | ENUMRESTYPEPROCW lpEnumFunc, LONG lParam)
|
|---|
| 415 | {
|
|---|
| 416 | Win32ImageBase *pModule;
|
|---|
| 417 |
|
|---|
| 418 | dprintf(("KERNEL32:EnumResourceTypesW(%08x,%08x,%08x)\n",
|
|---|
| 419 | hModule, lpEnumFunc, lParam));
|
|---|
| 420 |
|
|---|
| 421 | pModule = Win32ImageBase::findModule(hModule);
|
|---|
| 422 | if (pModule == NULL)
|
|---|
| 423 | {
|
|---|
| 424 | SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); //todo: right error????
|
|---|
| 425 | return FALSE;
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | return pModule->enumResourceTypesW(hModule, lpEnumFunc, lParam);
|
|---|
| 429 | }
|
|---|
| 430 | //******************************************************************************
|
|---|
| 431 | //******************************************************************************
|
|---|