| 1 | /* $Id: KERNEL32.CPP,v 1.42 2000-02-16 14:25:29 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Win32 compatibility file functions for OS/2 | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1998 Sander van Leeuwen | 
|---|
| 7 | * Copyright 1998 Patrick Haller | 
|---|
| 8 | * Copyright 1998 Peter Fitzsimmons | 
|---|
| 9 | * Copyright 1998 Knut St. Osmundsen | 
|---|
| 10 | * | 
|---|
| 11 | * @(#) KERNEL32.CPP            1.0.1   1998/06/12 PH added HandleManager support | 
|---|
| 12 | * | 
|---|
| 13 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 14 | * | 
|---|
| 15 | */ | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 | /***************************************************************************** | 
|---|
| 19 | * Includes                                                                  * | 
|---|
| 20 | *****************************************************************************/ | 
|---|
| 21 |  | 
|---|
| 22 | #include <odin.h> | 
|---|
| 23 | #include <odinwrap.h> | 
|---|
| 24 | #include <os2sel.h> | 
|---|
| 25 |  | 
|---|
| 26 | #include <os2win.h> | 
|---|
| 27 | #include <winnt.h> | 
|---|
| 28 | #include <winnls.h> | 
|---|
| 29 | #include <stdlib.h> | 
|---|
| 30 | #include <string.h> | 
|---|
| 31 |  | 
|---|
| 32 | #include "misc.h" | 
|---|
| 33 | #include <builtin.h> | 
|---|
| 34 | #include "heap.h" | 
|---|
| 35 | #include "handlemanager.h" | 
|---|
| 36 | #include "wprocess.h" | 
|---|
| 37 | #include <versionos2.h> | 
|---|
| 38 |  | 
|---|
| 39 | #define DBG_LOCALLOG    DBG_kernel32 | 
|---|
| 40 | #include "dbglocal.h" | 
|---|
| 41 |  | 
|---|
| 42 | /***************************************************************************** | 
|---|
| 43 | * Defines                                                                   * | 
|---|
| 44 | *****************************************************************************/ | 
|---|
| 45 |  | 
|---|
| 46 | ODINDEBUGCHANNEL(KERNEL32-KERNEL32) | 
|---|
| 47 |  | 
|---|
| 48 | /* this define enables certain less important debug messages */ | 
|---|
| 49 | //#define DEBUG_LOCAL 1 | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | /***************************************************************************** | 
|---|
| 54 | * Name      : BOOL WIN32API CloseHandle | 
|---|
| 55 | * Purpose   : forward call to Open32 | 
|---|
| 56 | * Parameters: | 
|---|
| 57 | * Variables : | 
|---|
| 58 | * Result    : | 
|---|
| 59 | * Remark    : | 
|---|
| 60 | * Status    : | 
|---|
| 61 | * | 
|---|
| 62 | * Author    : Patrick Haller [Fri, 1998/06/12 03:44] | 
|---|
| 63 | *****************************************************************************/ | 
|---|
| 64 | BOOL WIN32API CloseHandle(HANDLE hHandle) | 
|---|
| 65 | { | 
|---|
| 66 | dprintf(("KERNEL32: CloseHandle(%08xh)\n", | 
|---|
| 67 | hHandle)); | 
|---|
| 68 |  | 
|---|
| 69 | return HMCloseHandle(hHandle); | 
|---|
| 70 | } | 
|---|
| 71 |  | 
|---|
| 72 |  | 
|---|
| 73 | //****************************************************************************** | 
|---|
| 74 | HANDLE WIN32API GetStdHandle(DWORD fdwDevice) | 
|---|
| 75 | { | 
|---|
| 76 | HANDLE handle; | 
|---|
| 77 |  | 
|---|
| 78 | /* @@@PH 1998/02/12 Handle Manager Support */ | 
|---|
| 79 | handle = HMGetStdHandle(fdwDevice); | 
|---|
| 80 |  | 
|---|
| 81 | //@@@PH translate handle | 
|---|
| 82 |  | 
|---|
| 83 | /* handle = GetStdHandle(fdwDevice); */ | 
|---|
| 84 | dprintf(("KERNEL32:  GetStdHandle for device %X returned %X\n", fdwDevice, handle)); | 
|---|
| 85 | return(handle); | 
|---|
| 86 | } | 
|---|
| 87 | //****************************************************************************** | 
|---|
| 88 | //****************************************************************************** | 
|---|
| 89 | BOOL WIN32API SetStdHandle(DWORD  IDStdHandle, | 
|---|
| 90 | HANDLE hHandle) | 
|---|
| 91 | { | 
|---|
| 92 | dprintf(("KERNEL32:  SetStdHandle\n")); | 
|---|
| 93 |  | 
|---|
| 94 | ///@@@PH translate handle | 
|---|
| 95 |  | 
|---|
| 96 | return (HMSetStdHandle(IDStdHandle, | 
|---|
| 97 | hHandle)); | 
|---|
| 98 | } | 
|---|
| 99 | //****************************************************************************** | 
|---|
| 100 | //****************************************************************************** | 
|---|
| 101 | BOOL WIN32API IsBadWritePtr(LPVOID lpvPtr, UINT cbBytes) | 
|---|
| 102 | { | 
|---|
| 103 | #ifdef DEBUG | 
|---|
| 104 | BOOL rc; | 
|---|
| 105 |  | 
|---|
| 106 | rc = O32_IsBadWritePtr(lpvPtr, cbBytes); | 
|---|
| 107 | dprintf(("KERNEL32:  IsBadWritePtr: 0x%X size %d rc = %d\n", (int)lpvPtr, cbBytes, rc)); | 
|---|
| 108 | return(rc); | 
|---|
| 109 | #else | 
|---|
| 110 | return(O32_IsBadWritePtr(lpvPtr, cbBytes)); | 
|---|
| 111 | #endif | 
|---|
| 112 | } | 
|---|
| 113 | //****************************************************************************** | 
|---|
| 114 | //****************************************************************************** | 
|---|
| 115 | BOOL WIN32API IsBadReadPtr(CONST VOID *lpvPtr, UINT cbBytes) | 
|---|
| 116 | { | 
|---|
| 117 | #ifdef DEBUG | 
|---|
| 118 | BOOL rc; | 
|---|
| 119 |  | 
|---|
| 120 | rc = O32_IsBadReadPtr(lpvPtr, cbBytes); | 
|---|
| 121 | dprintf(("KERNEL32:  IsBadWritePtr: 0x%X size %d rc = %d\n", (int)lpvPtr, cbBytes, rc)); | 
|---|
| 122 | return(rc); | 
|---|
| 123 | #else | 
|---|
| 124 | return(O32_IsBadReadPtr(lpvPtr, cbBytes)); | 
|---|
| 125 | #endif | 
|---|
| 126 | } | 
|---|
| 127 | //****************************************************************************** | 
|---|
| 128 | //****************************************************************************** | 
|---|
| 129 | BOOL WIN32API IsBadCodePtr( FARPROC arg1) | 
|---|
| 130 | { | 
|---|
| 131 | dprintf(("KERNEL32:  IsBadCodePtr\n")); | 
|---|
| 132 | return O32_IsBadCodePtr(arg1); | 
|---|
| 133 | } | 
|---|
| 134 | //****************************************************************************** | 
|---|
| 135 | //****************************************************************************** | 
|---|
| 136 | BOOL WIN32API IsBadStringPtrA( LPCSTR arg1, UINT  arg2) | 
|---|
| 137 | { | 
|---|
| 138 | dprintf(("KERNEL32:  IsBadStringPtr")); | 
|---|
| 139 | return O32_IsBadStringPtr(arg1, arg2); | 
|---|
| 140 | } | 
|---|
| 141 | //****************************************************************************** | 
|---|
| 142 | //****************************************************************************** | 
|---|
| 143 | BOOL WIN32API IsBadStringPtrW(LPCWSTR arg1, UINT arg2) | 
|---|
| 144 | { | 
|---|
| 145 | dprintf(("KERNEL32:  OS2IsBadStringPtrW")); | 
|---|
| 146 | return O32_IsBadReadPtr((CONST VOID *)arg1, arg2*2+2); | 
|---|
| 147 | } | 
|---|
| 148 | //****************************************************************************** | 
|---|
| 149 | //****************************************************************************** | 
|---|
| 150 | DWORD WIN32API GetLastError() | 
|---|
| 151 | { | 
|---|
| 152 | DWORD rc; | 
|---|
| 153 |  | 
|---|
| 154 | rc = O32_GetLastError(); | 
|---|
| 155 | #ifdef DEBUG_LOCAL | 
|---|
| 156 | dprintf(("KERNEL32:  GetLastError returned %d\n", rc)); | 
|---|
| 157 | #endif | 
|---|
| 158 | return(rc); | 
|---|
| 159 | } | 
|---|
| 160 | //****************************************************************************** | 
|---|
| 161 | //****************************************************************************** | 
|---|
| 162 | VOID WIN32API SetLastError( DWORD arg1) | 
|---|
| 163 | { | 
|---|
| 164 | dprintf2(("KERNEL32:  SetLastError to %d\n", arg1)); | 
|---|
| 165 | O32_SetLastError(arg1); | 
|---|
| 166 | } | 
|---|
| 167 | //****************************************************************************** | 
|---|
| 168 | //****************************************************************************** | 
|---|
| 169 | UINT WIN32API GetOEMCP(VOID) | 
|---|
| 170 | { | 
|---|
| 171 | dprintf(("KERNEL32:  GetOEMCP\n")); | 
|---|
| 172 | return(O32_GetOEMCP()); | 
|---|
| 173 | } | 
|---|
| 174 | //****************************************************************************** | 
|---|
| 175 | //****************************************************************************** | 
|---|
| 176 | UINT WIN32API GetACP(VOID) | 
|---|
| 177 | { | 
|---|
| 178 | dprintf(("KERNEL32:  GetACP\n")); | 
|---|
| 179 | return(O32_GetACP()); | 
|---|
| 180 | } | 
|---|
| 181 | //****************************************************************************** | 
|---|
| 182 | //****************************************************************************** | 
|---|
| 183 | BOOL WIN32API GetStringTypeW(DWORD fdwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType) | 
|---|
| 184 | { | 
|---|
| 185 | int i; | 
|---|
| 186 |  | 
|---|
| 187 | dprintf(("KERNEL32:  GetStringTypeW, not properly implemented\n")); | 
|---|
| 188 | if((DWORD)lpSrcStr == (DWORD)lpCharType || !lpSrcStr || !lpCharType) { | 
|---|
| 189 | O32_SetLastError(ERROR_INVALID_PARAMETER); | 
|---|
| 190 | return(FALSE); | 
|---|
| 191 | } | 
|---|
| 192 | if(cchSrc == -1) | 
|---|
| 193 | cchSrc = UniStrlen((UniChar*)lpSrcStr); | 
|---|
| 194 |  | 
|---|
| 195 | memset(lpCharType, 0, cchSrc*sizeof(WORD)); | 
|---|
| 196 | switch(fdwInfoType) { | 
|---|
| 197 | case CT_CTYPE1: | 
|---|
| 198 | for(i=0;i<cchSrc;i++) { | 
|---|
| 199 | if(lpSrcStr[i] >= (WCHAR)'a' && lpSrcStr[i] <= (WCHAR)'z') | 
|---|
| 200 | lpCharType[i] |= C1_LOWER | C1_ALPHA; | 
|---|
| 201 | else | 
|---|
| 202 | if(lpSrcStr[i] >= (WCHAR)'A' && lpSrcStr[i] <= (WCHAR)'A') | 
|---|
| 203 | lpCharType[i] |= C1_UPPER | C1_ALPHA; | 
|---|
| 204 | else | 
|---|
| 205 | if(lpSrcStr[i] >= (WCHAR)'0' && lpSrcStr[i] <= (WCHAR)'9') | 
|---|
| 206 | lpCharType[i] |= C1_DIGIT; | 
|---|
| 207 | else | 
|---|
| 208 | if(lpSrcStr[i] >= (WCHAR)' ') | 
|---|
| 209 | lpCharType[i] |= C1_SPACE; | 
|---|
| 210 | } | 
|---|
| 211 | break; | 
|---|
| 212 | case CT_CTYPE2: | 
|---|
| 213 | case CT_CTYPE3: //not supported right now | 
|---|
| 214 | break; | 
|---|
| 215 | } | 
|---|
| 216 | return(TRUE); | 
|---|
| 217 | } | 
|---|
| 218 | //****************************************************************************** | 
|---|
| 219 | //NOTE: This has one parameter more than the W version! (@#$@#$) | 
|---|
| 220 | //****************************************************************************** | 
|---|
| 221 | BOOL WIN32API GetStringTypeA(LCID Locale, DWORD fdwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType) | 
|---|
| 222 | { | 
|---|
| 223 | int i; | 
|---|
| 224 |  | 
|---|
| 225 | dprintf(("KERNEL32:  GetStringTypeA, not properly implemented\n")); | 
|---|
| 226 | if(lpSrcStr == (LPCSTR)lpCharType || !lpSrcStr || !lpCharType) { | 
|---|
| 227 | O32_SetLastError(ERROR_INVALID_PARAMETER); | 
|---|
| 228 | return(FALSE); | 
|---|
| 229 | } | 
|---|
| 230 | if(cchSrc == -1) | 
|---|
| 231 | cchSrc = strlen(lpSrcStr); | 
|---|
| 232 |  | 
|---|
| 233 | memset(lpCharType, 0, cchSrc*sizeof(WORD)); | 
|---|
| 234 | switch(fdwInfoType) { | 
|---|
| 235 | case CT_CTYPE1: | 
|---|
| 236 | for(i=0;i<cchSrc;i++) { | 
|---|
| 237 | if(lpSrcStr[i] >= 'a' && lpSrcStr[i] <= 'z') | 
|---|
| 238 | lpCharType[i] |= C1_LOWER | C1_ALPHA; | 
|---|
| 239 | else | 
|---|
| 240 | if(lpSrcStr[i] >= 'A' && lpSrcStr[i] <= 'A') | 
|---|
| 241 | lpCharType[i] |= C1_UPPER | C1_ALPHA; | 
|---|
| 242 | else | 
|---|
| 243 | if(lpSrcStr[i] >= '0' && lpSrcStr[i] <= '9') | 
|---|
| 244 | lpCharType[i] |= C1_DIGIT; | 
|---|
| 245 | else | 
|---|
| 246 | if(lpSrcStr[i] >= ' ') | 
|---|
| 247 | lpCharType[i] |= C1_SPACE; | 
|---|
| 248 | } | 
|---|
| 249 | break; | 
|---|
| 250 | case CT_CTYPE2: | 
|---|
| 251 | case CT_CTYPE3: //not supported right now | 
|---|
| 252 | break; | 
|---|
| 253 | } | 
|---|
| 254 | return(TRUE); | 
|---|
| 255 | } | 
|---|
| 256 | //****************************************************************************** | 
|---|
| 257 | //****************************************************************************** | 
|---|
| 258 | BOOL WIN32API GetStringTypeExW(LCID Locale, DWORD fdwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType) | 
|---|
| 259 | { | 
|---|
| 260 | dprintf(("KERNEL32:  GetStringTypeExW, not properly implemented\n")); | 
|---|
| 261 | return(GetStringTypeW(fdwInfoType, lpSrcStr, cchSrc, lpCharType)); | 
|---|
| 262 | } | 
|---|
| 263 | //****************************************************************************** | 
|---|
| 264 | //****************************************************************************** | 
|---|
| 265 | BOOL WIN32API GetStringTypeExA(LCID Locale, DWORD fdwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType) | 
|---|
| 266 | { | 
|---|
| 267 | dprintf(("KERNEL32:  GetStringTypeExA, not properly implemented\n")); | 
|---|
| 268 | return(GetStringTypeA(Locale, fdwInfoType, lpSrcStr, cchSrc, lpCharType)); | 
|---|
| 269 | } | 
|---|
| 270 | //****************************************************************************** | 
|---|
| 271 | VOID WIN32API GlobalMemoryStatus( MEMORYSTATUS *arg1) | 
|---|
| 272 | { | 
|---|
| 273 | dprintf(("KERNEL32:  GlobalMemoryStatus\n")); | 
|---|
| 274 | O32_GlobalMemoryStatus(arg1); | 
|---|
| 275 | dprintf(("dwMemoryLoad    %X\n", arg1->dwMemoryLoad)); | 
|---|
| 276 | dprintf(("dwTotalPhys     %X\n", arg1->dwTotalPhys)); | 
|---|
| 277 | dprintf(("dwAvailPhys     %X\n", arg1->dwAvailPhys)); | 
|---|
| 278 | dprintf(("dwTotalPageFile %X\n", arg1->dwTotalPageFile)); | 
|---|
| 279 | dprintf(("dwAvailPageFile %X\n", arg1->dwAvailPageFile)); | 
|---|
| 280 | dprintf(("dwTotalVirtual  %X\n", arg1->dwTotalVirtual)); | 
|---|
| 281 | dprintf(("dwAvailVirtual  %X\n", arg1->dwAvailVirtual)); | 
|---|
| 282 | } | 
|---|
| 283 | VOID WIN32API Sleep(DWORD arg1) | 
|---|
| 284 | { | 
|---|
| 285 | dprintf2(("KERNEL32:  Sleep %d\n", arg1)); | 
|---|
| 286 | O32_Sleep(arg1); | 
|---|
| 287 | } | 
|---|
| 288 | //****************************************************************************** | 
|---|
| 289 | //****************************************************************************** | 
|---|
| 290 | DWORD WIN32API GetPriorityClass(HANDLE arg1) | 
|---|
| 291 | { | 
|---|
| 292 | dprintf(("KERNEL32:  GetPriorityClass\n")); | 
|---|
| 293 | return O32_GetPriorityClass(arg1); | 
|---|
| 294 | } | 
|---|
| 295 | //****************************************************************************** | 
|---|
| 296 | //****************************************************************************** | 
|---|
| 297 | BOOL WIN32API SetPriorityClass(HANDLE arg1, DWORD  arg2) | 
|---|
| 298 | { | 
|---|
| 299 | dprintf(("KERNEL32:  SetPriorityClass\n")); | 
|---|
| 300 | return O32_SetPriorityClass(arg1, arg2); | 
|---|
| 301 | } | 
|---|
| 302 | //****************************************************************************** | 
|---|
| 303 | //TODO! | 
|---|
| 304 | //****************************************************************************** | 
|---|
| 305 | int WIN32API LCMapStringW( | 
|---|
| 306 | DWORD /*LCID*/     Locale, | 
|---|
| 307 | DWORD    dwMapFlags, | 
|---|
| 308 | LPCWSTR  lpSrcStr, | 
|---|
| 309 | int      cchSrc, | 
|---|
| 310 | LPWSTR   lpDestStr, | 
|---|
| 311 | int      cchDest) | 
|---|
| 312 | { | 
|---|
| 313 | // quick hack!  this code is not done! | 
|---|
| 314 | if(cchSrc == -1) | 
|---|
| 315 | cchSrc = strlen((const char *)lpSrcStr); | 
|---|
| 316 | if(!cchDest) | 
|---|
| 317 | return cchSrc; | 
|---|
| 318 | strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest)); | 
|---|
| 319 | return max(cchSrc, cchDest); | 
|---|
| 320 | } | 
|---|
| 321 | //****************************************************************************** | 
|---|
| 322 | //TODO! | 
|---|
| 323 | //****************************************************************************** | 
|---|
| 324 | int WIN32API LCMapStringA( | 
|---|
| 325 | DWORD /*LCID*/     Locale, | 
|---|
| 326 | DWORD    dwMapFlags, | 
|---|
| 327 | LPCSTR   lpSrcStr, | 
|---|
| 328 | int      cchSrc, | 
|---|
| 329 | LPSTR    lpDestStr, | 
|---|
| 330 | int      cchDest) | 
|---|
| 331 | { | 
|---|
| 332 | dprintf(("KERNEL32:  LCMapStringA not implemented\n")); | 
|---|
| 333 | if(cchSrc == -1) | 
|---|
| 334 | cchSrc = strlen((const char *)lpSrcStr); | 
|---|
| 335 | if(!cchDest) | 
|---|
| 336 | return cchSrc; | 
|---|
| 337 | strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest)); | 
|---|
| 338 | return max(cchSrc, cchDest); | 
|---|
| 339 | } | 
|---|
| 340 | //****************************************************************************** | 
|---|
| 341 | //SvL: 24-6-'97 - Added | 
|---|
| 342 | //****************************************************************************** | 
|---|
| 343 | BOOL WIN32API Beep( DWORD arg1, DWORD  arg2) | 
|---|
| 344 | { | 
|---|
| 345 | dprintf(("KERNEL32:  OS2Beep\n")); | 
|---|
| 346 | return O32_Beep(arg1, arg2); | 
|---|
| 347 | } | 
|---|
| 348 | //****************************************************************************** | 
|---|
| 349 | //****************************************************************************** | 
|---|
| 350 | VOID WIN32API FatalAppExitA( UINT arg1, LPCSTR  arg2) | 
|---|
| 351 | { | 
|---|
| 352 | dprintf(("KERNEL32:  OS2FatalAppExitA\n")); | 
|---|
| 353 | O32_FatalAppExit(arg1, arg2); | 
|---|
| 354 | } | 
|---|
| 355 | //****************************************************************************** | 
|---|
| 356 | //****************************************************************************** | 
|---|
| 357 | VOID WIN32API FatalAppExitW(UINT arg1, LPCWSTR arg2) | 
|---|
| 358 | { | 
|---|
| 359 | char *astring; | 
|---|
| 360 |  | 
|---|
| 361 | dprintf(("KERNEL32:  OS2FatalAppExitW\n")); | 
|---|
| 362 | astring = UnicodeToAsciiString((LPWSTR)arg2); | 
|---|
| 363 | O32_FatalAppExit(arg1, astring); | 
|---|
| 364 | //probably won't return, but who cares.. | 
|---|
| 365 | FreeAsciiString(astring); | 
|---|
| 366 | } | 
|---|
| 367 | //****************************************************************************** | 
|---|
| 368 | //****************************************************************************** | 
|---|
| 369 | VOID WIN32API FatalExit( UINT arg1) | 
|---|
| 370 | { | 
|---|
| 371 | dprintf(("KERNEL32:  OS2FatalExit\n")); | 
|---|
| 372 | O32_FatalExit(arg1); | 
|---|
| 373 | } | 
|---|
| 374 | //****************************************************************************** | 
|---|
| 375 | //****************************************************************************** | 
|---|
| 376 | BOOL WIN32API IsBadHugeReadPtr( const void * arg1, UINT  arg2) | 
|---|
| 377 | { | 
|---|
| 378 | dprintf(("KERNEL32:  OS2IsBadHugeReadPtr\n")); | 
|---|
| 379 | return O32_IsBadHugeReadPtr(arg1, arg2); | 
|---|
| 380 | } | 
|---|
| 381 | //****************************************************************************** | 
|---|
| 382 | //****************************************************************************** | 
|---|
| 383 | BOOL WIN32API IsBadHugeWritePtr( PVOID arg1, UINT  arg2) | 
|---|
| 384 | { | 
|---|
| 385 | dprintf(("KERNEL32:  OS2IsBadHugeWritePtr\n")); | 
|---|
| 386 | return O32_IsBadHugeWritePtr(arg1, arg2); | 
|---|
| 387 | } | 
|---|
| 388 | //****************************************************************************** | 
|---|
| 389 | //****************************************************************************** | 
|---|
| 390 | BOOL WIN32API IsDBCSLeadByte(BYTE arg1) | 
|---|
| 391 | { | 
|---|
| 392 | dprintf2(("KERNEL32:  OS2IsDBCSLeadByte\n")); | 
|---|
| 393 | return O32_IsDBCSLeadByte(arg1); | 
|---|
| 394 | } | 
|---|
| 395 | //****************************************************************************** | 
|---|
| 396 | //****************************************************************************** | 
|---|
| 397 | DWORD WIN32API LoadModule( LPCSTR arg1, PVOID  arg2) | 
|---|
| 398 | { | 
|---|
| 399 | dprintf(("KERNEL32:  OS2LoadModule\n")); | 
|---|
| 400 | return O32_LoadModule(arg1, arg2); | 
|---|
| 401 | } | 
|---|
| 402 | //****************************************************************************** | 
|---|
| 403 | //****************************************************************************** | 
|---|
| 404 | int WIN32API MulDiv(int arg1, int arg2, int  arg3) | 
|---|
| 405 | { | 
|---|
| 406 | dprintf2(("KERNEL32:  MulDiv %d*%d/%d\n", arg1, arg2, arg3)); | 
|---|
| 407 | if(arg3 == 0) | 
|---|
| 408 | return 0; | 
|---|
| 409 |  | 
|---|
| 410 | return O32_MulDiv(arg1, arg2, arg3); | 
|---|
| 411 | } | 
|---|
| 412 | //****************************************************************************** | 
|---|
| 413 | UINT WIN32API CompareStringA(LCID lcid, DWORD fdwStyle, LPCSTR lpString1, | 
|---|
| 414 | DWORD cch1, LPCSTR lpString2, DWORD cch2) | 
|---|
| 415 | { | 
|---|
| 416 | int i; | 
|---|
| 417 | int fEqual = TRUE; | 
|---|
| 418 | char *string1 = (char *)lpString1, *string2 = (char *)lpString2; | 
|---|
| 419 |  | 
|---|
| 420 | #ifdef DEBUG | 
|---|
| 421 | if(fdwStyle & SORT_STRINGSORT) | 
|---|
| 422 | dprintf(("KERNEL32:  SORT_STRINGSORT not supported!\n")); | 
|---|
| 423 | if(fdwStyle & NORM_IGNORENONSPACE) | 
|---|
| 424 | dprintf(("KERNEL32:  NORM_IGNORENONSPACE not supported!\n")); | 
|---|
| 425 | if(fdwStyle & NORM_IGNORESYMBOLS) | 
|---|
| 426 | dprintf(("KERNEL32:  NORM_IGNORESYMBOLS not supported!\n")); | 
|---|
| 427 | #endif | 
|---|
| 428 |  | 
|---|
| 429 | if(cch1 == -1) cch1 = strlen(string1); | 
|---|
| 430 | if(cch2 == -1) cch2 = strlen(string2); | 
|---|
| 431 |  | 
|---|
| 432 | if(fdwStyle) { | 
|---|
| 433 | //TODO! | 
|---|
| 434 | if(fdwStyle != 0 && fdwStyle != NORM_IGNORECASE) | 
|---|
| 435 | return(0);  /*PLF Fri  98-03-13 04:09:32 was return 1 */ | 
|---|
| 436 | } | 
|---|
| 437 | if(fdwStyle & NORM_IGNORECASE) | 
|---|
| 438 | fEqual = strnicmp(string1, string2, min(cch1, cch2)); | 
|---|
| 439 | else | 
|---|
| 440 | fEqual = strncmp(string1, string2, min(cch1, cch2)); | 
|---|
| 441 |  | 
|---|
| 442 | if     (fEqual < 0 ) fEqual = 1; | 
|---|
| 443 | else if(fEqual == 0) fEqual = 2; | 
|---|
| 444 | else if(fEqual >  0) fEqual = 3; | 
|---|
| 445 |  | 
|---|
| 446 | //If equal, but different length, largest one is the greatest in lexical value | 
|---|
| 447 | if(fEqual == 2 && cch1 != cch2){ | 
|---|
| 448 | if(cch1 < cch2) | 
|---|
| 449 | fEqual = 1; | 
|---|
| 450 | else | 
|---|
| 451 | fEqual = 3; | 
|---|
| 452 | } | 
|---|
| 453 | dprintf2(("KERNEL32:  OS2CompareStringA '%s' - '%s' returned %d\n", lpString1, lpString2, fEqual)); | 
|---|
| 454 | return(fEqual); | 
|---|
| 455 | } | 
|---|
| 456 |  | 
|---|
| 457 | //****************************************************************************** | 
|---|
| 458 | //TODO: Not complete (fdwStyle flags specify compare method) | 
|---|
| 459 | //****************************************************************************** | 
|---|
| 460 | UINT WIN32API CompareStringW(LCID lcid, DWORD fdwStyle, LPCWSTR lpString1, | 
|---|
| 461 | DWORD cch1, LPCWSTR lpString2, DWORD cch2) | 
|---|
| 462 | { | 
|---|
| 463 | int i; | 
|---|
| 464 | int fEqual = TRUE; | 
|---|
| 465 | char *string1 = UnicodeToAsciiString((LPWSTR)lpString1); | 
|---|
| 466 | char *string2 = UnicodeToAsciiString((LPWSTR)lpString2); | 
|---|
| 467 |  | 
|---|
| 468 | dprintf2(("KERNEL32:  OS2CompareStringW '%s' - '%s'\n", string1, string2)); | 
|---|
| 469 |  | 
|---|
| 470 | fEqual = CompareStringA(lcid, fdwStyle, string1, cch1, string2, cch2); | 
|---|
| 471 | FreeAsciiString(string1); | 
|---|
| 472 | FreeAsciiString(string2); | 
|---|
| 473 |  | 
|---|
| 474 | return(fEqual); | 
|---|
| 475 | } | 
|---|
| 476 | //****************************************************************************** | 
|---|
| 477 | //Borrowed from Wine | 
|---|
| 478 | //****************************************************************************** | 
|---|
| 479 | ODINPROCEDURE1(GetStartupInfoA,LPSTARTUPINFOA,lpStartupInfo) | 
|---|
| 480 | { | 
|---|
| 481 | lpStartupInfo->cb               = sizeof(STARTUPINFOA); | 
|---|
| 482 | lpStartupInfo->lpReserved       = "<Reserved>"; | 
|---|
| 483 | lpStartupInfo->lpDesktop        = "Desktop"; | 
|---|
| 484 | lpStartupInfo->lpTitle          = "Title"; | 
|---|
| 485 | lpStartupInfo->dwX              = 0; | 
|---|
| 486 | lpStartupInfo->dwY              = 0; | 
|---|
| 487 | lpStartupInfo->dwXSize          = 640; | 
|---|
| 488 | lpStartupInfo->dwYSize          = 480; | 
|---|
| 489 | lpStartupInfo->dwXCountChars    = 80;      // for console | 
|---|
| 490 | lpStartupInfo->dwYCountChars    = 25; | 
|---|
| 491 | lpStartupInfo->dwFillAttribute  = 0x0720; | 
|---|
| 492 | lpStartupInfo->dwFlags          = STARTF_USESHOWWINDOW   | | 
|---|
| 493 | STARTF_USEPOSITION     | | 
|---|
| 494 | STARTF_USESIZE         | | 
|---|
| 495 | STARTF_USECOUNTCHARS   | | 
|---|
| 496 | STARTF_USEFILLATTRIBUTE| | 
|---|
| 497 | STARTF_USESTDHANDLES; | 
|---|
| 498 | lpStartupInfo->wShowWindow      = SW_SHOWDEFAULT; | 
|---|
| 499 | lpStartupInfo->cbReserved2      = 0; | 
|---|
| 500 | lpStartupInfo->lpReserved2      = NULL; /* must be NULL for VC runtime */ | 
|---|
| 501 | /* @@@PH 98/07/13 Handlemanager support */ | 
|---|
| 502 | lpStartupInfo->hStdInput        = GetStdHandle(STD_INPUT_HANDLE); | 
|---|
| 503 | lpStartupInfo->hStdOutput       = GetStdHandle(STD_OUTPUT_HANDLE); | 
|---|
| 504 | lpStartupInfo->hStdError        = GetStdHandle(STD_ERROR_HANDLE); | 
|---|
| 505 | return; | 
|---|
| 506 | } | 
|---|
| 507 | //****************************************************************************** | 
|---|
| 508 | //Borrowed from Wine | 
|---|
| 509 | //****************************************************************************** | 
|---|
| 510 | ODINPROCEDURE1(GetStartupInfoW,LPSTARTUPINFOW,lpStartupInfo) | 
|---|
| 511 | { | 
|---|
| 512 | static WCHAR lpReserved[] = {'<', 'R','e','s','e','r','v','e','d','>', 0}; | 
|---|
| 513 | static WCHAR lpDesktop[]  = {'D', 'e','s','k','t','o','p', 0}; | 
|---|
| 514 | static WCHAR lpTitle[]    = {'T', 'i','t','l','e', 0}; | 
|---|
| 515 |  | 
|---|
| 516 | // forward call to ascii variant | 
|---|
| 517 | GetStartupInfoA((LPSTARTUPINFOA)lpStartupInfo); | 
|---|
| 518 | lpStartupInfo->cb          = sizeof(STARTUPINFOW); | 
|---|
| 519 | lpStartupInfo->lpReserved  = lpReserved; | 
|---|
| 520 | lpStartupInfo->lpDesktop   = lpDesktop; | 
|---|
| 521 | lpStartupInfo->lpTitle     = lpTitle; | 
|---|
| 522 | return; | 
|---|
| 523 | } | 
|---|
| 524 | //****************************************************************************** | 
|---|
| 525 | //TODO: Not complete or correct, but sufficient for now | 
|---|
| 526 | //****************************************************************************** | 
|---|
| 527 | BOOL WIN32API GetBinaryTypeA(LPCTSTR lpApplicationName, LPDWORD lpBinaryType) | 
|---|
| 528 | { | 
|---|
| 529 | dprintf(("KERNEL32:  OS2GetBinaryTypeA %s\n", lpApplicationName)); | 
|---|
| 530 | if(strstr(lpApplicationName, ".EXE") ||   strstr(lpApplicationName, ".exe")) | 
|---|
| 531 | *lpBinaryType = SCS_32BIT_BINARY; | 
|---|
| 532 | else | 
|---|
| 533 | if(strstr(lpApplicationName, ".COM") ||   strstr(lpApplicationName, ".com")) | 
|---|
| 534 | *lpBinaryType = SCS_DOS_BINARY; | 
|---|
| 535 | else | 
|---|
| 536 | if(strstr(lpApplicationName, ".PIF") ||   strstr(lpApplicationName, ".pif")) | 
|---|
| 537 | *lpBinaryType = SCS_PIF_BINARY; | 
|---|
| 538 | else  return(FALSE); | 
|---|
| 539 | return(TRUE); | 
|---|
| 540 | } | 
|---|
| 541 | //****************************************************************************** | 
|---|
| 542 | //****************************************************************************** | 
|---|
| 543 | BOOL WIN32API GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType) | 
|---|
| 544 | { | 
|---|
| 545 | BOOL rc; | 
|---|
| 546 | char  *astring; | 
|---|
| 547 |  | 
|---|
| 548 | dprintf(("KERNEL32:  OS2GetBinaryTypeW\n")); | 
|---|
| 549 | astring = UnicodeToAsciiString((LPWSTR)lpApplicationName); | 
|---|
| 550 | rc = GetBinaryTypeA(astring, lpBinaryType); | 
|---|
| 551 | FreeAsciiString(astring); | 
|---|
| 552 | return(rc); | 
|---|
| 553 | } | 
|---|
| 554 | //****************************************************************************** | 
|---|
| 555 | //TODO: SetLastError | 
|---|
| 556 | //****************************************************************************** | 
|---|
| 557 | BOOL WIN32API GetVersionExA(OSVERSIONINFOA *lpVersionInformation) | 
|---|
| 558 | { | 
|---|
| 559 | dprintf(("KERNEL32:  OS2GetVersionExA\n")); | 
|---|
| 560 |  | 
|---|
| 561 | if(lpVersionInformation == NULL || lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA)) | 
|---|
| 562 | return(FALSE); | 
|---|
| 563 |  | 
|---|
| 564 | lpVersionInformation->dwMajorVersion = ODINNT_MAJOR_VERSION;    //pretend we're NT 4.0 | 
|---|
| 565 | lpVersionInformation->dwMinorVersion = ODINNT_MINOR_VERSION; | 
|---|
| 566 | lpVersionInformation->dwBuildNumber  = ODINNT_BUILD_NR; | 
|---|
| 567 | lpVersionInformation->dwPlatformId   = VER_PLATFORM_WIN32_NT; | 
|---|
| 568 | strcpy(lpVersionInformation->szCSDVersion, ODINNT_CSDVERSION); | 
|---|
| 569 | return(TRUE); | 
|---|
| 570 | } | 
|---|
| 571 | //****************************************************************************** | 
|---|
| 572 | //****************************************************************************** | 
|---|
| 573 | BOOL WIN32API GetVersionExW(OSVERSIONINFOW *lpVersionInformation) | 
|---|
| 574 | { | 
|---|
| 575 | dprintf(("KERNEL32:  OS2GetVersionExW\n")); | 
|---|
| 576 |  | 
|---|
| 577 | if(lpVersionInformation == NULL || lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW)) | 
|---|
| 578 | return(FALSE); | 
|---|
| 579 |  | 
|---|
| 580 | lpVersionInformation->dwMajorVersion = ODINNT_MAJOR_VERSION;    //pretend we're NT 4.0 | 
|---|
| 581 | lpVersionInformation->dwMinorVersion = ODINNT_MINOR_VERSION; | 
|---|
| 582 | lpVersionInformation->dwBuildNumber  = ODINNT_BUILD_NR; | 
|---|
| 583 | lpVersionInformation->dwPlatformId   = VER_PLATFORM_WIN32_NT; | 
|---|
| 584 | lstrcpyW(lpVersionInformation->szCSDVersion, ODINNT_CSDVERSION_W); | 
|---|
| 585 | return(TRUE); | 
|---|
| 586 | } | 
|---|
| 587 | //****************************************************************************** | 
|---|
| 588 | //****************************************************************************** | 
|---|
| 589 | LONG WIN32API GetVersion() | 
|---|
| 590 | { | 
|---|
| 591 | dprintf(("KERNEL32:  GetVersion\n")); | 
|---|
| 592 | // highword 0 = NT, lowword high byte major ver, low byte minor ver | 
|---|
| 593 | /* @@@PH 98/04/04 MFC30 makes assumptions about process control block        */ | 
|---|
| 594 | /*                structures that lead to crashes if we don't identify as NT */ | 
|---|
| 595 |  | 
|---|
| 596 | return ODINNT_VERSION; | 
|---|
| 597 | } | 
|---|
| 598 | //****************************************************************************** | 
|---|
| 599 | //SvL: 26-6-'97 - Added | 
|---|
| 600 | //****************************************************************************** | 
|---|
| 601 | VOID WIN32API OutputDebugStringW(LPCWSTR arg1) | 
|---|
| 602 | { | 
|---|
| 603 | char *astring; | 
|---|
| 604 |  | 
|---|
| 605 | astring = UnicodeToAsciiString((LPWSTR)arg1); | 
|---|
| 606 | dprintf(("KERNEL32:  OS2OutputDebugStringW %s\n", astring)); | 
|---|
| 607 | FreeAsciiString(astring); | 
|---|
| 608 | } | 
|---|
| 609 | //****************************************************************************** | 
|---|
| 610 | //****************************************************************************** | 
|---|
| 611 | VOID WIN32API OutputDebugStringA(LPCSTR lpszOutputString) | 
|---|
| 612 | { | 
|---|
| 613 | dprintf(("KERNEL32:  OutputDebugStringA: %s\n", lpszOutputString)); | 
|---|
| 614 | return; | 
|---|
| 615 | } | 
|---|
| 616 | //****************************************************************************** | 
|---|
| 617 | //****************************************************************************** | 
|---|
| 618 | BOOL WIN32API FlushInstructionCache(     /*PLF Mon  98-02-09 23:56:49 : STUB STUB STUB STUB STUB */ | 
|---|
| 619 | HANDLE hProcess,    /* process with cache to flush  */ | 
|---|
| 620 | LPCVOID lpvBase,    /* address of region to flush   */ | 
|---|
| 621 | DWORD cbFlush)      /* length of region to flush    */ | 
|---|
| 622 |  | 
|---|
| 623 | { | 
|---|
| 624 | dprintf(("FlushInstructionCache() - NIY\n")); | 
|---|
| 625 | return TRUE; | 
|---|
| 626 | } | 
|---|
| 627 |  | 
|---|
| 628 |  | 
|---|
| 629 | int WIN32API GetNumberFormatA(LCID     Locale, | 
|---|
| 630 | DWORD    dwFlags, | 
|---|
| 631 | LPCSTR lpValue, | 
|---|
| 632 | CONST NUMBERFMTA *lpFormat, | 
|---|
| 633 | LPSTR  lpNumberStr, | 
|---|
| 634 | int      cchNumber) | 
|---|
| 635 | { | 
|---|
| 636 | dprintf(("KERNEL32::OS2GetNumberFormatA(%08x,%08x,%s,%08x,%s,%08x) not implemented.\n", | 
|---|
| 637 | Locale, | 
|---|
| 638 | dwFlags, | 
|---|
| 639 | lpValue, | 
|---|
| 640 | lpFormat, | 
|---|
| 641 | lpNumberStr, | 
|---|
| 642 | cchNumber)); | 
|---|
| 643 |  | 
|---|
| 644 | return 0; | 
|---|
| 645 | } | 
|---|
| 646 |  | 
|---|
| 647 | int WIN32API GetNumberFormatW(LCID     Locale, | 
|---|
| 648 | DWORD    dwFlags, | 
|---|
| 649 | LPCWSTR lpValue, | 
|---|
| 650 | CONST NUMBERFMTW *lpFormat, | 
|---|
| 651 | LPWSTR  lpNumberStr, | 
|---|
| 652 | int      cchNumber) | 
|---|
| 653 | { | 
|---|
| 654 | dprintf(("KERNEL32::OS2GetNumberFormatW(%08x,%08x,%s,%08x,%s,%08x) not implemented.\n", | 
|---|
| 655 | Locale, | 
|---|
| 656 | dwFlags, | 
|---|
| 657 | lpValue, | 
|---|
| 658 | lpFormat, | 
|---|
| 659 | lpNumberStr, | 
|---|
| 660 | cchNumber)); | 
|---|
| 661 |  | 
|---|
| 662 | return 0; | 
|---|
| 663 | } | 
|---|
| 664 |  | 
|---|
| 665 | BOOL WIN32API FindCloseChangeNotification(HANDLE hChange) | 
|---|
| 666 | { | 
|---|
| 667 | dprintf(("KERNEL32:  OS2FindNextChangeNotification, Not implemented\n")); | 
|---|
| 668 |  | 
|---|
| 669 | return(TRUE); | 
|---|
| 670 | } | 
|---|
| 671 |  | 
|---|
| 672 | //****************************************************************************** | 
|---|
| 673 | //****************************************************************************** | 
|---|
| 674 | void WIN32API WrongComctl32() | 
|---|
| 675 | { | 
|---|
| 676 | O32_MessageBox(NULL, | 
|---|
| 677 | "KERNEL32.36 not implemented", | 
|---|
| 678 | "Win32 for OS/2 Error", | 
|---|
| 679 | MB_OK); | 
|---|
| 680 | ExitProcess(987); | 
|---|
| 681 | } | 
|---|
| 682 | //****************************************************************************** | 
|---|
| 683 |  | 
|---|
| 684 | /*********************************************************************** | 
|---|
| 685 | *           RtlFillMemory   (KERNEL32.441) | 
|---|
| 686 | */ | 
|---|
| 687 | VOID WIN32API RtlFillMemory(LPVOID ptr, | 
|---|
| 688 | UINT len, | 
|---|
| 689 | UINT fill ) | 
|---|
| 690 | { | 
|---|
| 691 | #ifdef DEBUG_LOCAL | 
|---|
| 692 | dprintf(("KERNEL32: RtlFillMemory(%08x,%08x,%08x)\n", | 
|---|
| 693 | ptr, | 
|---|
| 694 | len, | 
|---|
| 695 | fill)); | 
|---|
| 696 | #endif | 
|---|
| 697 |  | 
|---|
| 698 | memset(ptr, | 
|---|
| 699 | fill, | 
|---|
| 700 | len ); | 
|---|
| 701 | } | 
|---|
| 702 |  | 
|---|
| 703 |  | 
|---|
| 704 | /*********************************************************************** | 
|---|
| 705 | *           RtlMoveMemory   (KERNEL32.442) | 
|---|
| 706 | */ | 
|---|
| 707 | VOID WIN32API RtlMoveMemory(LPVOID  dst, | 
|---|
| 708 | LPCVOID src, | 
|---|
| 709 | UINT  len ) | 
|---|
| 710 | { | 
|---|
| 711 | dprintf2(("KERNEL32: RtlMoveMemory(%08x,%08x,%08x)\n", | 
|---|
| 712 | dst, | 
|---|
| 713 | src, | 
|---|
| 714 | len)); | 
|---|
| 715 |  | 
|---|
| 716 | memmove(dst, | 
|---|
| 717 | src, | 
|---|
| 718 | len ); | 
|---|
| 719 | } | 
|---|
| 720 |  | 
|---|
| 721 |  | 
|---|
| 722 | /*********************************************************************** | 
|---|
| 723 | *           RtlZeroMemory   (KERNEL32.444) | 
|---|
| 724 | */ | 
|---|
| 725 | VOID WIN32API RtlZeroMemory(LPVOID ptr, | 
|---|
| 726 | UINT len) | 
|---|
| 727 | { | 
|---|
| 728 | dprintf2(("KERNEL32: RtlZeroMemory(%08x,%08x)\n", | 
|---|
| 729 | ptr, | 
|---|
| 730 | len)); | 
|---|
| 731 |  | 
|---|
| 732 | memset(ptr, | 
|---|
| 733 | 0, | 
|---|
| 734 | len); | 
|---|
| 735 | } | 
|---|
| 736 |  | 
|---|
| 737 | //****************************************************************************** | 
|---|
| 738 | /*KSO Thu 21.05.1998*/ | 
|---|
| 739 | BOOL WIN32API IsDBCSLeadByteEx(UINT CodePage, BYTE TestChar) | 
|---|
| 740 | { | 
|---|
| 741 | dprintf(("KERNEL32:  OS2IsDBCSLeadByteEx - not correctly implemented\n")); | 
|---|
| 742 | return O32_IsDBCSLeadByte(TestChar); | 
|---|
| 743 | } | 
|---|
| 744 | //****************************************************************************** | 
|---|
| 745 |  | 
|---|
| 746 |  | 
|---|
| 747 |  | 
|---|
| 748 |  | 
|---|
| 749 |  | 
|---|
| 750 |  | 
|---|
| 751 |  | 
|---|
| 752 |  | 
|---|
| 753 | /***************************************************************************** | 
|---|
| 754 | * Name      : BOOL GetSystemPowerStatus | 
|---|
| 755 | * Purpose   : The GetSystemPowerStatus function retrieves the power status of | 
|---|
| 756 | *             the system. The status indicates whether the system is running | 
|---|
| 757 | *             on AC or DC power, whether the battery is currently charging, | 
|---|
| 758 | *             and how much battery life currently remains. | 
|---|
| 759 | * Parameters: LPSYSTEM_POWER_STATUS lpSystemPowerStatus | 
|---|
| 760 | * Variables : | 
|---|
| 761 | * Result    : TRUE / FALSE | 
|---|
| 762 | * Remark    : | 
|---|
| 763 | * Status    : UNTESTED STUB | 
|---|
| 764 | * | 
|---|
| 765 | * Author    : Patrick Haller [Mon, 1998/06/15 08:00] | 
|---|
| 766 | *****************************************************************************/ | 
|---|
| 767 |  | 
|---|
| 768 | BOOL WIN32API GetSystemPowerStatus(LPSYSTEM_POWER_STATUS lpSystemPowerStatus) | 
|---|
| 769 | { | 
|---|
| 770 | dprintf(("Kernel32: GetSystemPowerStatus(%08xh) not properly implemented.\n", | 
|---|
| 771 | lpSystemPowerStatus)); | 
|---|
| 772 |  | 
|---|
| 773 | if(lpSystemPowerStatus == NULL) { | 
|---|
| 774 | SetLastError(ERROR_INVALID_PARAMETER); | 
|---|
| 775 | return FALSE; | 
|---|
| 776 | } | 
|---|
| 777 | lpSystemPowerStatus->ACLineStatus       = 1; //online | 
|---|
| 778 | lpSystemPowerStatus->BatteryFlag        = 128; //no system battery | 
|---|
| 779 | lpSystemPowerStatus->BatteryLifePercent = 255; //unknown | 
|---|
| 780 | lpSystemPowerStatus->reserved           = 0; | 
|---|
| 781 | lpSystemPowerStatus->BatteryLifeTime    = -1; //unknown | 
|---|
| 782 | lpSystemPowerStatus->BatteryFullLifeTime= -1; //unknown | 
|---|
| 783 |  | 
|---|
| 784 | return TRUE; | 
|---|
| 785 | } | 
|---|