Ignore:
Timestamp:
Nov 25, 1999, 8:19:57 PM (26 years ago)
Author:
sandervl
Message:

EB's unicode changes + removal of advapi32 dependency

File:
1 edited

Legend:

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

    r1820 r1838  
    1 /* $Id: cpu.cpp,v 1.2 1999-11-23 20:01:17 sandervl Exp $ */
     1/* $Id: cpu.cpp,v 1.3 1999-11-25 19:19:57 sandervl Exp $ */
    22/*
    33 * Odin win32 CPU apis
     
    2626static BYTE PF[64] = {0,};
    2727static nrCPUs = 1;
     28static HINSTANCE hInstance = 0;
     29
     30LONG (WINAPI *ADVAPI32_RegCloseKey)(HKEY) = 0;
     31LONG (WINAPI *ADVAPI32_RegCreateKeyA)(HKEY,LPCSTR,LPHKEY) = 0;
     32LONG (WINAPI *ADVAPI32_RegSetValueExA)(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD) = 0;
     33
    2834//******************************************************************************
    2935//******************************************************************************
     
    3137{
    3238  SYSTEM_INFO si;
     39
     40   hInstance = LoadLibraryA("ADVAPI32.DLL");
     41   if(hInstance) {
     42        *(VOID **)&ADVAPI32_RegCloseKey=(void*)GetProcAddress(hInstance, (LPCSTR)"RegCloseKey");
     43        *(VOID **)&ADVAPI32_RegCreateKeyA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegCreateKeyA");
     44        *(VOID **)&ADVAPI32_RegSetValueExA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegSetValueExA");
     45   }
    3346
    3447   nrCPUs = nrcpus;
     
    97110
    98111        /* Create this registry key for all systems */
    99         if (RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey)!=ERROR_SUCCESS) {
     112        if (ADVAPI32_RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey)!=ERROR_SUCCESS) {
    100113            dprintf(("Unable to register CPU information\n"));
    101114        }
     
    108121                sprintf(buf,"%d",i);
    109122                if (xhkey)
    110                         RegCloseKey(xhkey);
    111                 RegCreateKeyA(hkey,buf,&xhkey);
     123                        ADVAPI32_RegCloseKey(xhkey);
     124                ADVAPI32_RegCreateKeyA(hkey,buf,&xhkey);
    112125
    113126                signature = GetCPUSignature();
     
    132145                sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
    133146                if (xhkey) {
    134                         RegSetValueExA(xhkey,"Identifier",0,REG_SZ,(LPBYTE)buf,strlen(buf));
     147                        ADVAPI32_RegSetValueExA(xhkey,"Identifier",0,REG_SZ,(LPBYTE)buf,strlen(buf));
    135148                        memset(buf, 0, sizeof(buf));
    136149                        GetCPUVendorString(buf);
    137                         RegSetValueExA(xhkey,"VendorIdentifier",0,REG_SZ,(LPBYTE)buf,strlen(buf));
     150                        ADVAPI32_RegSetValueExA(xhkey,"VendorIdentifier",0,REG_SZ,(LPBYTE)buf,strlen(buf));
    138151                }
    139152                cachedsi.wProcessorRevision = signature & 0xf;
     
    157170                if (features & CPUID_FPU_PRESENT) {
    158171                        if (i == 0) {
    159                                 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor",&fpukey)!=ERROR_SUCCESS)
     172                                if(ADVAPI32_RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor",&fpukey)!=ERROR_SUCCESS)
    160173                                        dprintf(("Unable to register FPU information\n"));
    161174                        }
     
    163176                        if(fpukey) {
    164177                                sprintf(buf,"%d",i);
    165                                 RegCreateKeyA(fpukey,buf,&xhfpukey);
     178                                ADVAPI32_RegCreateKeyA(fpukey,buf,&xhfpukey);
    166179                        }
    167180                }
     
    172185
    173186        if (xhkey)
    174                 RegCloseKey(xhkey);
     187                ADVAPI32_RegCloseKey(xhkey);
    175188        if (hkey)
    176                 RegCloseKey(hkey);
     189                ADVAPI32_RegCloseKey(hkey);
    177190        if (xhfpukey)
    178                 RegCloseKey(xhfpukey);
     191                ADVAPI32_RegCloseKey(xhfpukey);
    179192        if (fpukey)
    180                 RegCloseKey(fpukey);
     193                ADVAPI32_RegCloseKey(fpukey);
    181194
    182195}
Note: See TracChangeset for help on using the changeset viewer.