- Timestamp:
- Dec 1, 1999, 7:40:49 PM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/Fileio.cpp
r1893 r1924 1 /* $Id: Fileio.cpp,v 1.1 7 1999-11-30 19:40:25sandervl Exp $ */1 /* $Id: Fileio.cpp,v 1.18 1999-12-01 18:40:47 sandervl Exp $ */ 2 2 3 3 /* … … 94 94 rc = FindFirstFileA(astring, &wfda); 95 95 96 // convert back the result structure 97 memcpy(arg2, 98 &wfda, 99 sizeof(WIN32_FIND_DATAA)); 100 101 lstrcpynAtoW (arg2->cFileName, 102 wfda.cFileName, 103 sizeof(wfda.cFileName)); 104 105 lstrcpynAtoW (arg2->cAlternateFileName, 106 wfda.cAlternateFileName, 107 sizeof(wfda.cAlternateFileName)); 108 96 if(rc == -1) { 97 memset(arg2, 0, sizeof(WIN32_FIND_DATAW)); 98 } 99 else { 100 // convert back the result structure 101 memcpy(arg2, 102 &wfda, 103 sizeof(WIN32_FIND_DATAA)); 104 105 lstrcpynAtoW (arg2->cFileName, 106 wfda.cFileName, 107 sizeof(wfda.cFileName)); 108 109 lstrcpynAtoW (arg2->cAlternateFileName, 110 wfda.cAlternateFileName, 111 sizeof(wfda.cAlternateFileName)); 112 } 109 113 FreeAsciiString(astring); 110 114 return(rc); … … 119 123 } 120 124 //****************************************************************************** 121 //TODO: convert string in WIN32_FIND_DATAW * structure122 125 //****************************************************************************** 123 126 ODINFUNCTION2(BOOL, FindNextFileW, … … 130 133 rc = FindNextFileA(arg1, &wfda); 131 134 132 // convert back the result structure 133 memcpy(arg2, 134 &wfda, 135 sizeof(WIN32_FIND_DATAA)); 136 137 lstrcpynAtoW (arg2->cFileName, 138 wfda.cFileName, 139 sizeof(wfda.cFileName)); 140 141 lstrcpynAtoW (arg2->cAlternateFileName, 142 wfda.cAlternateFileName, 143 sizeof(wfda.cAlternateFileName)); 144 135 if(rc == 0) { 136 memset(arg2, 0, sizeof(WIN32_FIND_DATAW)); 137 } 138 else { 139 // convert back the result structure 140 memcpy(arg2, 141 &wfda, 142 sizeof(WIN32_FIND_DATAA)); 143 144 lstrcpynAtoW (arg2->cFileName, 145 wfda.cFileName, 146 sizeof(wfda.cFileName)); 147 148 lstrcpynAtoW (arg2->cAlternateFileName, 149 wfda.cAlternateFileName, 150 sizeof(wfda.cAlternateFileName)); 151 } 145 152 return rc; 146 153 } -
trunk/src/kernel32/KERNEL32.DEF
r1885 r1924 1 ; $Id: KERNEL32.DEF,v 1.5 3 1999-11-30 14:15:53sandervl Exp $1 ; $Id: KERNEL32.DEF,v 1.54 1999-12-01 18:40:47 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 19 19 _DosAliasMem = DOSCALLS.298 20 20 DosQuerySysState = DOSCALLS.368 21 _DosQuerySysState = DOSCALLS.368 21 22 22 23 _O32_RegCloseKey = PMWINX.541 -
trunk/src/kernel32/makefile
r1885 r1924 1 # $Id: makefile,v 1.6 5 1999-11-30 14:15:54sandervl Exp $1 # $Id: makefile,v 1.66 1999-12-01 18:40:48 sandervl Exp $ 2 2 3 3 # … … 97 97 process.obj: process.cpp \ 98 98 $(PDWIN32_INCLUDE)\misc.h \ 99 oslibdos.h \ 100 $(PDWIN32_INCLUDE)\winimagebase.h \ 99 101 $(PDWIN32_INCLUDE)\wprocess.h 100 102 -
trunk/src/kernel32/oslibdos.cpp
r1914 r1924 1 /* $Id: oslibdos.cpp,v 1.1 1 1999-12-01 10:47:51sandervl Exp $ */1 /* $Id: oslibdos.cpp,v 1.12 1999-12-01 18:40:48 sandervl Exp $ */ 2 2 3 3 /* … … 23 23 #include "initterm.h" 24 24 #include "oslibdos.h" 25 #include "dosqss.h" 25 26 26 27 APIRET APIENTRY DosAliasMem(PVOID pb, ULONG cb, PPVOID ppbAlias, ULONG fl); … … 548 549 } 549 550 //****************************************************************************** 550 //****************************************************************************** 551 //Returns time spent in kernel & user mode in milliseconds 552 //****************************************************************************** 553 BOOL OSLibDosQueryProcTimes(DWORD procid, ULONG *kerneltime, ULONG *usertime) 554 { 555 APIRET rc; 556 char *buf; 557 ULONG size; 558 ULONG nrthreads = 4; 559 560 tryagain: 561 size = sizeof(QTOPLEVEL)+sizeof(QGLOBAL)+sizeof(QPROCESS) + nrthreads*sizeof(QTHREAD); 562 buf = (char *)malloc(size); 563 rc = DosQuerySysState(0x1, RESERVED, procid, RESERVED, (PCHAR)buf, size); 564 565 if(rc) { 566 free(buf); 567 if(rc == ERROR_BUFFER_OVERFLOW) { 568 nrthreads += 4; 569 goto tryagain; 570 } 571 return FALSE; 572 } 573 PQTOPLEVEL top = (PQTOPLEVEL)buf; 574 575 *kerneltime = 0; 576 *usertime = 0; 577 for(int i=0;i<top->procdata->threadcnt;i++) { 578 *kerneltime += top->procdata->threads[i].systime; 579 *usertime += top->procdata->threads[i].usertime; 580 } 581 free(buf); 582 return TRUE; 583 } 584 //****************************************************************************** 585 //****************************************************************************** -
trunk/src/kernel32/oslibdos.h
r1811 r1924 1 /* $Id: oslibdos.h,v 1. 8 1999-11-22 20:35:50sandervl Exp $ */1 /* $Id: oslibdos.h,v 1.9 1999-12-01 18:40:48 sandervl Exp $ */ 2 2 3 3 /* … … 98 98 #endif 99 99 100 void OSLibDosDisableHardError(BOOL fTurnOff); 101 BOOL OSLibDosQueryProcTimes(DWORD procid, ULONG *kerneltime, ULONG *usertime); 102 100 103 #endif -
trunk/src/kernel32/process.cpp
r1893 r1924 1 /* $Id: process.cpp,v 1. 2 1999-11-30 19:40:26sandervl Exp $ */1 /* $Id: process.cpp,v 1.3 1999-12-01 18:40:48 sandervl Exp $ */ 2 2 3 3 /* … … 29 29 #include <win\task.h> 30 30 #include <winimagebase.h> 31 #include "oslibdos.h" 31 32 32 33 #define SHUTDOWN_NORETRY 1 … … 390 391 } 391 392 } 392 //****************************************************************************** 393 //****************************************************************************** 393 /***************************************************************************** 394 * Name : BOOL GetProcessTimes 395 * Purpose : The GetProcessTimes function obtains timing information about a specified process. 396 * Parameters: HANDLE hProcess specifies the process of interest 397 * LPFILETIME lpCreationTime when the process was created 398 * LPFILETIME lpExitTime when the process exited 399 * LPFILETIME lpKernelTime time the process has spent in kernel mode 400 * LPFILETIME lpUserTime time the process has spent in user mode 401 * Variables : 402 * Result : TRUE / FALSE 403 * Remark : 404 * Status : UNTESTED STUB 405 * 406 * Author : Patrick Haller [Mon, 1998/06/15 08:00] 407 *****************************************************************************/ 408 409 ULONG (WINAPI *NtdllRtlExtendedIntegerMultiply)(LARGE_INTEGER factor1, 410 INT factor2) = 0; 411 412 BOOL WIN32API GetProcessTimes(HANDLE hProcess, 413 LPFILETIME lpCreationTime, 414 LPFILETIME lpExitTime, 415 LPFILETIME lpKernelTime, 416 LPFILETIME lpUserTime) 417 { 418 LARGE_INTEGER *kerneltime, *usertime; 419 420 dprintf(("Kernel32: GetProcessTimes(%08xh,%08xh,%08xh,%08xh,%08xh) partly implemented", 421 hProcess, 422 lpCreationTime, 423 lpExitTime, 424 lpKernelTime, 425 lpUserTime)); 426 427 if(!NtdllRtlExtendedIntegerMultiply) { 428 HINSTANCE hInstance = LoadLibraryA("NTDLL.DLL"); 429 if(hInstance) 430 *(VOID **)&NtdllRtlExtendedIntegerMultiply=(void*)GetProcAddress(hInstance, (LPCSTR)"RtlExtendedIntegerMultiply"); 431 } 432 if(!lpCreationTime || !lpExitTime || !lpKernelTime || !lpUserTime) { 433 SetLastError(ERROR_INVALID_PARAMETER); 434 return FALSE; 435 } 436 if(hProcess != GetCurrentProcess()) { 437 dprintf(("GetProcessTimes unknown process")); 438 return FALSE; 439 } 440 441 SystemTimeToFileTime(&ProcessPDB.creationTime, lpCreationTime); 442 memset(lpExitTime, 0, sizeof(FILETIME)); 443 memset(lpKernelTime, 0, sizeof(FILETIME)); 444 memset(lpUserTime, 0, sizeof(FILETIME)); 445 446 kerneltime = (LARGE_INTEGER *)lpKernelTime; 447 usertime = (LARGE_INTEGER *)lpUserTime; 448 OSLibDosQueryProcTimes(GetCurrentProcessId(), &lpKernelTime->dwLowDateTime, &lpUserTime->dwLowDateTime); 449 //TODO: Isn't correct -> (if result's high dword != 0) 450 kerneltime->u.LowPart = NtdllRtlExtendedIntegerMultiply(*kerneltime, 10); 451 usertime->u.LowPart = NtdllRtlExtendedIntegerMultiply(*usertime, 10); 452 return TRUE; 453 } 454 //****************************************************************************** 455 //****************************************************************************** -
trunk/src/kernel32/stubs.cpp
r1885 r1924 1 /* $Id: stubs.cpp,v 1.1 0 1999-11-30 14:15:54sandervl Exp $ */1 /* $Id: stubs.cpp,v 1.11 1999-12-01 18:40:48 sandervl Exp $ */ 2 2 3 3 /* … … 2136 2136 } 2137 2137 2138 /*****************************************************************************2139 * Name : BOOL GetProcessTimes2140 * Purpose : The GetProcessTimes function obtains timing information about a specified process.2141 * Parameters: HANDLE hProcess specifies the process of interest2142 * LPFILETIME lpCreationTime when the process was created2143 * LPFILETIME lpExitTime when the process exited2144 * LPFILETIME lpKernelTime time the process has spent in kernel mode2145 * LPFILETIME lpUserTime time the process has spent in user mode2146 * Variables :2147 * Result : TRUE / FALSE2148 * Remark :2149 * Status : UNTESTED STUB2150 *2151 * Author : Patrick Haller [Mon, 1998/06/15 08:00]2152 *****************************************************************************/2153 2154 BOOL WIN32API GetProcessTimes(HANDLE hProcess,2155 LPFILETIME lpCreationTime,2156 LPFILETIME lpExitTime,2157 LPFILETIME lpKernelTime,2158 LPFILETIME lpUserTime)2159 {2160 dprintf(("Kernel32: GetProcessTimes(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",2161 hProcess,2162 lpCreationTime,2163 lpExitTime,2164 lpKernelTime,2165 lpUserTime));2166 2167 return (FALSE);2168 }2169 2170 2138 2171 2139 -
trunk/src/kernel32/unicode.cpp
r1871 r1924 1 /* $Id: unicode.cpp,v 1.1 6 1999-11-28 23:23:46 birdExp $ */1 /* $Id: unicode.cpp,v 1.17 1999-12-01 18:40:49 sandervl Exp $ */ 2 2 3 3 /* … … 207 207 { 208 208 int i; 209 int rc ;209 int rc, length; 210 210 size_t uni_chars_left; 211 211 size_t out_bytes_left; … … 223 223 224 224 // dprintf(("KERNEL32: UnicodeToAsciiN\n")); 225 226 length = UniStrlen(ustring)+1; 227 unilen = min(length, unilen); 228 225 229 if (getUconvObject()) 226 230 { -
trunk/src/kernel32/wprocess.cpp
r1893 r1924 1 /* $Id: wprocess.cpp,v 1.5 3 1999-11-30 19:40:27sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.54 1999-12-01 18:40:49 sandervl Exp $ */ 2 2 3 3 /* … … 158 158 ProcessPDB.winver = 0xffff; /* to be determined */ 159 159 ProcessPDB.server_pid = (void *)GetCurrentProcessId(); 160 161 GetSystemTime(&ProcessPDB.creationTime); 160 162 161 163 /* Initialize the critical section */
Note:
See TracChangeset
for help on using the changeset viewer.