Changeset 1838 for trunk/src/kernel32/cpu.cpp
- Timestamp:
- Nov 25, 1999, 8:19:57 PM (26 years ago)
- 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 $ */ 2 2 /* 3 3 * Odin win32 CPU apis … … 26 26 static BYTE PF[64] = {0,}; 27 27 static nrCPUs = 1; 28 static HINSTANCE hInstance = 0; 29 30 LONG (WINAPI *ADVAPI32_RegCloseKey)(HKEY) = 0; 31 LONG (WINAPI *ADVAPI32_RegCreateKeyA)(HKEY,LPCSTR,LPHKEY) = 0; 32 LONG (WINAPI *ADVAPI32_RegSetValueExA)(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD) = 0; 33 28 34 //****************************************************************************** 29 35 //****************************************************************************** … … 31 37 { 32 38 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 } 33 46 34 47 nrCPUs = nrcpus; … … 97 110 98 111 /* 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) { 100 113 dprintf(("Unable to register CPU information\n")); 101 114 } … … 108 121 sprintf(buf,"%d",i); 109 122 if (xhkey) 110 RegCloseKey(xhkey);111 RegCreateKeyA(hkey,buf,&xhkey);123 ADVAPI32_RegCloseKey(xhkey); 124 ADVAPI32_RegCreateKeyA(hkey,buf,&xhkey); 112 125 113 126 signature = GetCPUSignature(); … … 132 145 sprintf(buf,"CPU %ld",cachedsi.dwProcessorType); 133 146 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)); 135 148 memset(buf, 0, sizeof(buf)); 136 149 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)); 138 151 } 139 152 cachedsi.wProcessorRevision = signature & 0xf; … … 157 170 if (features & CPUID_FPU_PRESENT) { 158 171 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) 160 173 dprintf(("Unable to register FPU information\n")); 161 174 } … … 163 176 if(fpukey) { 164 177 sprintf(buf,"%d",i); 165 RegCreateKeyA(fpukey,buf,&xhfpukey);178 ADVAPI32_RegCreateKeyA(fpukey,buf,&xhfpukey); 166 179 } 167 180 } … … 172 185 173 186 if (xhkey) 174 RegCloseKey(xhkey);187 ADVAPI32_RegCloseKey(xhkey); 175 188 if (hkey) 176 RegCloseKey(hkey);189 ADVAPI32_RegCloseKey(hkey); 177 190 if (xhfpukey) 178 RegCloseKey(xhfpukey);191 ADVAPI32_RegCloseKey(xhfpukey); 179 192 if (fpukey) 180 RegCloseKey(fpukey);193 ADVAPI32_RegCloseKey(fpukey); 181 194 182 195 }
Note:
See TracChangeset
for help on using the changeset viewer.