Ignore:
Timestamp:
Aug 18, 1999, 7:18:01 PM (26 years ago)
Author:
sandervl
Message:

PE loader changes

File:
1 edited

Legend:

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

    r544 r550  
    1 /* $Id: wprocess.cpp,v 1.21 1999-08-18 12:24:17 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.22 1999-08-18 17:18:01 sandervl Exp $ */
    22
    33/*
     
    440440  return hDll;
    441441}
    442 
    443 
    444442//******************************************************************************
    445443//******************************************************************************
     
    452450  hDll = O32_LoadLibrary(lpszLibFile);
    453451  if(hDll) {
    454     return hDll;    //converted dll or win32k took care of it
     452        return hDll;    //converted dll or win32k took care of it
    455453  }
    456454
     
    597595    if(rc)      AsciiToUnicode(asciifilename, lpFileName);
    598596    free(asciifilename);
     597    return(rc);
     598}
     599//******************************************************************************
     600//NOTE: GetModuleHandleA does NOT support files with multiple dots (i.e.
     601//      very.weird.exe)
     602//******************************************************************************
     603HANDLE WIN32API GetModuleHandleA(LPCTSTR lpszModule)
     604{
     605 HANDLE    hMod;
     606 Win32Dll *windll;
     607 char      szModule[CCHMAXPATH];
     608 BOOL      fDllModule = FALSE;
     609
     610  if(lpszModule == NULL) {
     611        hMod = WinExe->getInstanceHandle();
     612  }
     613  else {
     614        strcpy(szModule, StripPath((char *)lpszModule));
     615        strupr(szModule);
     616        if(strstr(szModule, ".DLL")) {
     617                fDllModule = TRUE;
     618        }
     619        else {
     620                if(!strstr(szModule, ".")) {
     621                        //if there's no extension or trainling dot, we
     622                        //assume it's a dll (see Win32 SDK docs)
     623                        fDllModule = TRUE;
     624                }
     625        }
     626        char *dot = strstr(szModule, ".");
     627        if(dot)
     628                *dot = 0;
     629
     630        if(!fDllModule && !strcmpi(lpszModule, WinExe->getModuleName())) {
     631                hMod = WinExe->getInstanceHandle();
     632        }
     633        else {
     634                windll = Win32Dll::findModule(szModule);
     635                if(windll) {
     636                        hMod = windll->getInstanceHandle();
     637                }
     638                else    hMod = OS2iGetModuleHandleA( (PSZ) lpszModule);
     639        }
     640  }
     641
     642  eprintf(("KERNEL32:  GetModuleHandle %s returned %X\n", lpszModule, hMod));
     643  return(hMod);
     644}
     645//******************************************************************************
     646//******************************************************************************
     647HMODULE WIN32API GetModuleHandleW(LPCWSTR arg1)
     648{
     649 HMODULE rc;
     650 char   *astring;
     651
     652    astring = UnicodeToAsciiString((LPWSTR)arg1);
     653    rc = GetModuleHandleA(astring);
     654    dprintf(("KERNEL32:  OS2GetModuleHandleW %s returned %X\n", astring, rc));
     655    FreeAsciiString(astring);
    599656    return(rc);
    600657}
Note: See TracChangeset for help on using the changeset viewer.