Changeset 114 for trunk/src/kernel32/KERNEL32.CPP
- Timestamp:
- Jun 17, 1999, 11:52:01 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.CPP
r111 r114 1 /* $Id: KERNEL32.CPP,v 1. 5 1999-06-17 18:21:36phaller Exp $ */1 /* $Id: KERNEL32.CPP,v 1.6 1999-06-17 21:52:00 phaller Exp $ */ 2 2 3 3 /* … … 46 46 47 47 /***************************************************************************** 48 * Name : BOOL WIN32API CreateEventA49 * Purpose : forward call to Open3250 * Parameters:51 * Variables :52 * Result :53 * Remark :54 * Status :55 *56 * Author : Patrick Haller [Fri, 1998/06/12 03:44]57 *****************************************************************************/58 59 HANDLE WIN32API CreateEventA(LPSECURITY_ATTRIBUTES lpsa,60 BOOL fManualReset,61 BOOL fInitialState,62 LPCTSTR lpszEventName)63 {64 ULONG rc; /* API returncode */65 HANDLE hOS2; /* 32-bit OS/2 handle */66 HANDLE hWindows; /* 16-bit Windows handle */67 68 dprintf(("KERNEL32::CreateEventA(%08xh, %08xh, %08xh, %s)\n",69 lpsa,70 fManualReset,71 fInitialState,72 lpszEventName));73 74 hOS2 = O32_CreateEvent(lpsa, /* create event semaphore */75 fManualReset,76 fInitialState,77 lpszEventName);78 if (hOS2 != 0) /* check handle */79 {80 rc = HMHandleAllocate(&hWindows, /* allocate handle */81 hOS2);82 if (rc == NO_ERROR) /* check for errors */83 return (hWindows); /* return translated handle */84 else85 return (0); /* raise error condition */86 }87 88 return (hOS2); /* should have the correct error value here */89 }90 91 /*****************************************************************************92 48 * Name : BOOL WIN32API CloseHandle 93 49 * Purpose : forward call to Open32 … … 109 65 110 66 111 /*****************************************************************************112 * Name : BOOL WIN32API CreateEventW113 * Purpose : forward call to Open32114 * Parameters:115 * Variables :116 * Result :117 * Remark : handle translation is done in CreateEventA118 * Status :119 *120 * Author : Patrick Haller [Fri, 1998/06/12 03:44]121 *****************************************************************************/122 123 HANDLE WIN32API CreateEventW(PSECURITY_ATTRIBUTES arg1,124 BOOL arg2,125 BOOL arg3,126 LPCWSTR arg4)127 {128 HANDLE rc;129 char *astring;130 131 dprintf(("KERNEL32::CreateEventW>(%08xh, %08xh, %08xh, %s)\n",132 arg1,133 arg2,134 arg3,135 arg4));136 137 astring = UnicodeToAsciiString((LPWSTR)arg4);138 139 rc = O32_CreateEvent(arg1,140 arg2,141 arg3,142 astring);143 144 FreeAsciiString(astring);145 146 return(rc);147 }148 ///@@@PH handlemanager149 //******************************************************************************150 //******************************************************************************151 HANDLE WIN32API CreateMutexA(LPSECURITY_ATTRIBUTES lpsa,152 BOOL fInitialOwner,153 LPCTSTR lpszMutexName)154 {155 dprintf(("KERNEL32: CreateMutex\n"));156 157 return(O32_CreateMutex(lpsa,158 fInitialOwner,159 lpszMutexName));160 }161 //******************************************************************************162 //******************************************************************************163 HANDLE WIN32API CreateMutexW(PSECURITY_ATTRIBUTES arg1,164 BOOL arg2,165 LPCWSTR arg3)166 {167 HANDLE rc;168 char *astring;169 170 dprintf(("KERNEL32: OS2CreateMutexW\n"));171 172 astring = UnicodeToAsciiString((LPWSTR)arg3);173 rc = O32_CreateMutex(arg1,174 arg2,175 astring);176 FreeAsciiString(astring);177 178 return(rc);179 }180 //******************************************************************************181 67 //****************************************************************************** 182 68 HANDLE WIN32API GetModuleHandleA(LPCTSTR lpszModule) … … 218 104 //****************************************************************************** 219 105 //****************************************************************************** 220 BOOL WIN32API ReleaseMutex(HANDLE mutex)221 {222 dprintf(("KERNEL32: ReleaseMutex\n"));223 return(O32_ReleaseMutex(mutex));224 }225 //******************************************************************************226 //******************************************************************************227 BOOL WIN32API SetEvent(HANDLE hEvent)228 {229 dprintf(("KERNEL32: SetEvent\n"));230 return(O32_SetEvent(hEvent));231 }232 //******************************************************************************233 //******************************************************************************234 106 BOOL WIN32API SetStdHandle(DWORD IDStdHandle, 235 107 HANDLE hHandle) … … 273 145 return(O32_TlsSetValue(index, val)); 274 146 } 275 //******************************************************************************276 //******************************************************************************277 DWORD WIN32API WaitForSingleObject(HANDLE hObject,278 DWORD timeout)279 {280 dprintf(("KERNEL32: WaitForSingleObject (%08xh, %08xh)\n",281 hObject,282 timeout));283 284 return(O32_WaitForSingleObject(hObject,285 timeout));286 }287 //******************************************************************************288 289 290 /*****************************************************************************291 * Name : DWORD OS2WaitForSingleObjectEx292 * Purpose : The WaitForSingleObjectEx function is an extended wait function293 * that can be used to perform an alertable wait. This enables the294 * function to return when the system queues an I/O completion295 * routine to be executed by the calling thread. The function also296 * returns when the specified object is in the signaled state or297 * when the time-out interval elapses.298 * Parameters: HANDLE hObject handle of object to wait for299 * DWORD dwTimeout time-out interval in milliseconds300 * BOOL fAlertable alertable wait flag301 * Variables :302 * Result : 0xFFFFFFFF in case of error303 * Remark : only really required for async I/O304 * Status : UNTESTED STUB305 *306 * Author : Patrick Haller [Mon, 1998/06/15 08:00]307 *****************************************************************************/308 309 DWORD WIN32API WaitForSingleObjectEx(HANDLE hObject,310 DWORD dwTimeout,311 BOOL fAlertable)312 {313 dprintf(("Kernel32: WaitForSingleObjectEx(%08xh,%08xh,%08xh) not implemented correctly.\n",314 hObject,315 dwTimeout,316 fAlertable));317 318 return(O32_WaitForSingleObject(hObject,319 dwTimeout));320 }321 322 147 //****************************************************************************** 323 148 //****************************************************************************** … … 404 229 //****************************************************************************** 405 230 //****************************************************************************** 406 BOOL WIN32API FlushFileBuffers(HANDLE hFile)407 {408 dprintf(("KERNEL32: FlushFileBuffers\n"));409 return(O32_FlushFileBuffers(hFile));410 }411 //******************************************************************************412 //******************************************************************************413 231 LONG WIN32API InterlockedDecrement(LPLONG lplVal) 414 232 { … … 429 247 dprintf(("KERNEL32: InterlockedExchange\n")); 430 248 return O32_InterlockedExchange(arg1, arg2); 431 }432 //******************************************************************************433 //******************************************************************************434 UINT WIN32API SetHandleCount(UINT cHandles)435 {436 dprintf(("KERNEL32: GetHandleCount\n"));437 return(O32_SetHandleCount(cHandles));438 249 } 439 250 //****************************************************************************** … … 762 573 } 763 574 //****************************************************************************** 764 //SvL: 24-6-'97 - Added765 //SvL: 28-6-'97: Fix for timeSetEvent in Red Alert Map Editor766 //******************************************************************************767 BOOL WIN32API DuplicateHandle(HANDLE srcprocess, HANDLE srchandle, HANDLE destprocess,768 PHANDLE desthandle, DWORD arg5, BOOL arg6, DWORD arg7)769 {770 BOOL rc;771 772 #if 0773 //SvL:774 //If source & destination process are identical, just copy handle775 //(if target pointer != NULL)776 //timeSetEvent's timer handler expects to be called from another process,777 //but we just create a separate timer thread inside the client process778 if(srcprocess == destprocess) {779 if(desthandle != NULL)780 *desthandle = srchandle;781 return(TRUE);782 }783 #endif784 rc = O32_DuplicateHandle(srcprocess, srchandle, destprocess, desthandle, arg5, arg6, arg7);785 //// dprintf(("KERNEL32: OS2DuplicateHandle returned %d\n", rc));786 return(rc);787 }788 //******************************************************************************789 575 //****************************************************************************** 790 576 BOOL WIN32API Beep( DWORD arg1, DWORD arg2) … … 792 578 dprintf(("KERNEL32: OS2Beep\n")); 793 579 return O32_Beep(arg1, arg2); 794 }795 //******************************************************************************796 //******************************************************************************797 HANDLE WIN32API CreateSemaphoreA(PSECURITY_ATTRIBUTES arg1, LONG arg2, LONG arg3, LPCSTR arg4)798 {799 dprintf(("KERNEL32: OS2CreateSemaphoreA\n"));800 return O32_CreateSemaphore(arg1, arg2, arg3, (LPSTR)arg4);801 }802 //******************************************************************************803 //******************************************************************************804 HANDLE WIN32API CreateSemaphoreW(PSECURITY_ATTRIBUTES arg1,805 LONG arg2, LONG arg3,806 LPCWSTR arg4)807 {808 HANDLE rc;809 char *astring;810 811 dprintf(("KERNEL32: OS2CreateSemaphoreW"));812 astring = UnicodeToAsciiString((LPWSTR)arg4);813 rc = O32_CreateSemaphore(arg1, arg2, arg3, astring);814 FreeAsciiString(astring);815 return(rc);816 580 } 817 581 //****************************************************************************** … … 867 631 //****************************************************************************** 868 632 //****************************************************************************** 869 BOOL WIN32API GetOverlappedResult(HANDLE arg1, LPOVERLAPPED arg2, LPDWORD arg3, BOOL arg4)870 {871 dprintf(("KERNEL32: OS2GetOverlappedResult\n"));872 return O32_GetOverlappedResult(arg1, arg2, arg3, arg4);873 }874 //******************************************************************************875 //******************************************************************************876 633 BOOL WIN32API IsBadHugeReadPtr( const void * arg1, UINT arg2) 877 634 { … … 909 666 //****************************************************************************** 910 667 //****************************************************************************** 911 HANDLE WIN32API OpenEventA( DWORD arg1, BOOL arg2, LPCSTR arg3)912 {913 dprintf(("KERNEL32: OS2OpenEventA\n"));914 return O32_OpenEvent(arg1, arg2, arg3);915 }916 //******************************************************************************917 //******************************************************************************918 HANDLE WIN32API OpenEventW(DWORD dwDesiredAccess, BOOL bInheritHandle,919 LPCWSTR lpName)920 {921 char *asciiname;922 HANDLE rc;923 924 dprintf(("KERNEL32: OS2OpenEventW\n"));925 asciiname = UnicodeToAsciiString((LPWSTR)lpName);926 rc = O32_OpenEvent(dwDesiredAccess, bInheritHandle, asciiname);927 FreeAsciiString(asciiname);928 return(rc);929 }930 //******************************************************************************931 //******************************************************************************932 HANDLE WIN32API OpenMutexA( DWORD arg1, BOOL arg2, LPCSTR arg3)933 {934 dprintf(("KERNEL32: OS2OpenMutexA\n"));935 return O32_OpenMutex(arg1, arg2, arg3);936 }937 //******************************************************************************938 //******************************************************************************939 HANDLE WIN32API OpenMutexW(DWORD dwDesiredAccess, BOOL bInheritHandle,940 LPCWSTR lpName)941 {942 char *asciiname;943 HANDLE rc;944 945 dprintf(("KERNEL32: OS2OpenMutexW\n"));946 asciiname = UnicodeToAsciiString((LPWSTR)lpName);947 rc = O32_OpenMutex(dwDesiredAccess, bInheritHandle, asciiname);948 FreeAsciiString(asciiname);949 return(rc);950 }951 //******************************************************************************952 //******************************************************************************953 668 HANDLE WIN32API OpenProcess(DWORD arg1, BOOL arg2, DWORD arg3) 954 669 { 955 670 dprintf(("KERNEL32: OS2OpenProcess\n")); 956 671 return O32_OpenProcess(arg1, arg2, arg3); 957 }958 //******************************************************************************959 //******************************************************************************960 HANDLE WIN32API OpenSemaphoreA( DWORD arg1, BOOL arg2, LPCSTR arg3)961 {962 dprintf(("KERNEL32: OS2OpenSemaphoreA"));963 return O32_OpenSemaphore(arg1, arg2, arg3);964 }965 //******************************************************************************966 //******************************************************************************967 HANDLE WIN32API OpenSemaphoreW(DWORD dwDesiredAccess, BOOL bInheritHandle,968 LPCWSTR lpName)969 {970 char *asciiname;971 HANDLE rc;972 973 dprintf(("KERNEL32: OS2OpenSemaphoreW"));974 asciiname = UnicodeToAsciiString((LPWSTR)lpName);975 rc = O32_OpenSemaphore(dwDesiredAccess, bInheritHandle, asciiname);976 FreeAsciiString(asciiname);977 return(rc);978 }979 //******************************************************************************980 //******************************************************************************981 BOOL WIN32API PulseEvent( HANDLE arg1)982 {983 dprintf(("KERNEL32: OS2PulseEvent\n"));984 return O32_PulseEvent(arg1);985 }986 //******************************************************************************987 //******************************************************************************988 BOOL WIN32API ReleaseSemaphore( HANDLE arg1, LONG arg2, PLONG arg3)989 {990 dprintf(("KERNEL32: OS2ReleaseSemaphore"));991 return O32_ReleaseSemaphore(arg1, arg2, arg3);992 }993 //******************************************************************************994 //******************************************************************************995 BOOL WIN32API ResetEvent(HANDLE arg1)996 {997 dprintf(("KERNEL32: ResetEvent(%08xh)\n",998 arg1));999 1000 return O32_ResetEvent(arg1);1001 }1002 //******************************************************************************1003 //******************************************************************************1004 DWORD WIN32API WaitForMultipleObjects( DWORD arg1, const HANDLE * arg2, BOOL arg3, DWORD arg4)1005 {1006 dprintf(("KERNEL32: OS2WaitForMultipleObjects"));1007 return O32_WaitForMultipleObjects(arg1, arg2, arg3, arg4);1008 }1009 1010 1011 /*****************************************************************************1012 * Name : DWORD OS2WaitForMultipleObjectsEx1013 * Purpose : The WaitForMultipleObjectsEx function is an extended wait1014 * function that can be used to perform an alertable wait. This1015 * enables the function to return when the system queues an I/O1016 * completion routine to be executed by the calling thread. The1017 * function also returns either when any one or when all of the1018 * specified objects are in the signaled state, or when the1019 * time-out interval elapses.1020 * Parameters: DWORD cObjects number of handles in handle array1021 * HANDLE *lphObjects address of object-handle array1022 * BOOL fWaitAll wait flag1023 * DWORD dwTimeout time-out interval in milliseconds1024 * BOOL fAlertable alertable wait flag1025 * Variables :1026 * Result : 0xFFFFFFFF in case of error1027 * Remark : only really required for async I/O1028 * Status : UNTESTED STUB1029 *1030 * Author : Patrick Haller [Mon, 1998/06/15 08:00]1031 *****************************************************************************/1032 1033 DWORD WIN32API WaitForMultipleObjectsEx(DWORD cObjects,1034 CONST HANDLE *lphObjects,1035 BOOL fWaitAll,1036 DWORD dwTimeout,1037 BOOL fAlertable)1038 {1039 dprintf(("Kernel32: WaitForMultipleObjectsEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented correctly.\n",1040 cObjects,1041 lphObjects,1042 fWaitAll,1043 dwTimeout,1044 fAlertable));1045 1046 return(O32_WaitForMultipleObjects(cObjects,1047 lphObjects,1048 fWaitAll,1049 dwTimeout));1050 672 } 1051 673 //****************************************************************************** … … 1458 1080 } 1459 1081 1460 HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle)1461 //HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle,1462 // BOOL fInherit)1463 {1464 return (hHandle);1465 }1466 1467 1082 BOOL WIN32API FindCloseChangeNotification(HANDLE hChange) 1468 1083 {
Note:
See TracChangeset
for help on using the changeset viewer.