Ignore:
Timestamp:
Feb 25, 2002, 1:02:35 PM (23 years ago)
Author:
sandervl
Message:

Added custom findresource hook support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/resource.cpp

    r4224 r8012  
    1 /* $Id: resource.cpp,v 1.17 2000-09-08 18:07:50 sandervl Exp $ */
     1/* $Id: resource.cpp,v 1.18 2002-02-25 12:02:17 sandervl Exp $ */
    22
    33/*
     
    1616#include <winexebase.h>
    1717#include <windllbase.h>
     18#include <custombuild.h>
    1819
    1920#define DBG_LOCALLOG    DBG_resource
    2021#include "dbglocal.h"
    2122
     23
     24static PFNFINDRESOURCEEXA pfnCustomFindResourceA = NULL;
     25static PFNFINDRESOURCEEXW pfnCustomFindResourceW = NULL;
     26
     27//******************************************************************************
     28//Called by custom Odin builds to hook FindReource(Ex)A/W calls
     29//******************************************************************************
     30BOOL WIN32API SetCustomFindResource(PFNFINDRESOURCEEXA pfnFindResourceA, PFNFINDRESOURCEEXW pfnFindResourceW)
     31{
     32    pfnCustomFindResourceA = pfnFindResourceA;
     33    pfnCustomFindResourceW = pfnFindResourceW;
     34    return TRUE;
     35}
    2236//******************************************************************************
    2337//lpszName = integer id (high word 0), else string (name or "#237")
     
    2741{
    2842 Win32ImageBase *module;
    29 
     43 WORD wLanguage = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
     44
     45    if(pfnCustomFindResourceA) {
     46        pfnCustomFindResourceA(&hModule, (LPSTR *)&lpszName, (LPSTR *)&lpszType, &wLanguage);
     47    }
    3048    module = Win32ImageBase::findModule(hModule);
    3149    if(module == NULL) {
     
    3351          return(NULL);
    3452    }
    35     return module->findResourceA(lpszName, (LPSTR)lpszType);
     53    return module->findResourceA(lpszName, (LPSTR)lpszType, wLanguage);
    3654}
    3755//******************************************************************************
    3856//******************************************************************************
    3957HRSRC WIN32API FindResourceW(HINSTANCE hModule, LPCWSTR lpszName,
    40                           LPCWSTR lpszType)
     58                             LPCWSTR lpszType)
    4159{
    4260 Win32ImageBase *module;
    43 
     61 WORD wLanguage = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
     62
     63    if(pfnCustomFindResourceW) {
     64        pfnCustomFindResourceW(&hModule, (LPWSTR *)&lpszName, (LPWSTR *)&lpszType, &wLanguage);
     65    }
    4466    module = Win32ImageBase::findModule(hModule);
    4567    if(module == NULL) {
     
    4769          return(NULL);
    4870    }
    49 
    50     return module->findResourceW((LPWSTR)lpszName, (LPWSTR)lpszType);
     71    return module->findResourceW((LPWSTR)lpszName, (LPWSTR)lpszType, wLanguage);
    5172}
    5273/*****************************************************************************
     
    6586 *             If the function fails, the return value is NULL
    6687 * Remark    :
    67  * Status    : UNTESTED STUB
     88 * Status    : fully implemented
    6889 *
    6990 * Author    : SvL
     
    7495{
    7596 Win32ImageBase *module;
     97
     98    if(pfnCustomFindResourceA) {
     99        pfnCustomFindResourceA(&hModule, (LPSTR *)&lpName, (LPSTR *)&lpType, &wLanguage);
     100    }
    76101
    77102    module = Win32ImageBase::findModule(hModule);
     
    99124 *             If the function fails, the return value is NULL
    100125 * Remark    :
    101  * Status    : UNTESTED STUB
     126 * Status    : fully implemented
    102127 *
    103128 * Author    : SvL
    104129 *****************************************************************************/
    105130
    106 HRSRC WIN32API FindResourceExW(HMODULE hModule,
    107                                LPCWSTR lpType,
    108                                LPCWSTR lpName,
    109                                WORD    wLanguage)
     131HRSRC WIN32API FindResourceExW(HMODULE hModule, LPCWSTR lpType,
     132                               LPCWSTR lpName, WORD wLanguage)
    110133{
    111134 Win32ImageBase *module;
     135
     136    if(pfnCustomFindResourceW) {
     137        pfnCustomFindResourceW(&hModule, (LPWSTR *)&lpName, (LPWSTR *)&lpType, &wLanguage);
     138    }
    112139
    113140    module = Win32ImageBase::findModule(hModule);
     
    186213 * @param    lpEnumFunc    pointer to callback function
    187214 * @param    lParam        application-defined parameter
    188  * @status   stub
     215 * @status   fully implemented
    189216 * @author   knut st. osmundsen
    190217 * @remark   The EnumResourceNames function continues to enumerate resource
     
    225252 * @param    lpEnumFunc    pointer to callback function
    226253 * @param    lParam        application-defined parameter
    227  * @status   stub
     254 * @status   fully implemented
    228255 * @author   knut st. osmundsen
    229256 * @remark   The EnumResourceNames function continues to enumerate resource
     
    267294 *             resource languages until the callback function returns FALSE
    268295 *             or all resource languages have been enumerated.
    269  * Status    : UNTESTED STUB
     296 * Status    : fully implemented
    270297 *
    271298 * Author    : Markus Montkowski [Tha, 1998/05/21 17:46]
     
    308335 *             resource languages until the callback function returns FALSE
    309336 *             or all resource languages have been enumerated.
    310  * Status    : UNTESTED STUB
     337 * Status    : fully implemented
    311338 *
    312339 * Author    : Markus Montkowski [Tha, 1998/05/21 17:46]
     
    344371 *             If the function fails, the return value is zero
    345372 * Remark    :
    346  * Status    : UNTESTED STUB
     373 * Status    : fully implemented
    347374 *
    348375 * Author    : Markus Montkowski [Tha, 1998/05/21 17:46]
     
    379406 *             If the function fails, the return value is zero
    380407 * Remark    :
    381  * Status    : UNTESTED STUB
     408 * Status    : fully implemented
    382409 *
    383410 * Author    : Markus Montkowski [Tha, 1998/05/21 17:46]
     
    401428    return pModule->enumResourceTypesW(hModule, lpEnumFunc, lParam);
    402429}
     430//******************************************************************************
     431//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.