- Timestamp:
- Jan 10, 2003, 1:57:14 PM (23 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/HandleManager.cpp
r9235 r9653 1 /* $Id: HandleManager.cpp,v 1.9 1 2002-09-14 13:49:39sandervl Exp $ */1 /* $Id: HandleManager.cpp,v 1.92 2003-01-10 12:57:11 sandervl Exp $ */ 2 2 3 3 /* … … 268 268 TabWin32Handles[ulLoop].hmHandleData.hWin32Handle = (HANDLE)ulLoop; 269 269 TabWin32Handles[ulLoop].hmHandleData.lpDeviceData = NULL; 270 TabWin32Handles[ulLoop].hmHandleData.dwHandleInformation = 0; 270 271 handleMutex.leave(); 271 272 return (ulLoop); /* OK, then return it to the caller */ … … 1083 1084 HMHandleTemp.hWin32Handle = iIndexNew; 1084 1085 HMHandleTemp.lpDeviceData = pDevData; 1086 HMHandleTemp.dwHandleInformation = 0; 1085 1087 } 1086 1088 … … 1286 1288 } 1287 1289 1288 1290 /***************************************************************************** 1291 * Name : DWORD HMGetHandleInformation 1292 * Purpose : The GetHandleInformation function obtains information about certain 1293 * properties of an object handle. The information is obtained as a set of bit flags. 1294 * Parameters: HANDLE hObject 1295 * LPDWORD lpdwFlags 1296 * Variables : 1297 * Result : TRUE / FALSE 1298 * Remark : 1299 * Status : 1300 * 1301 * Author : SvL 1302 *****************************************************************************/ 1303 BOOL HMGetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags) 1304 { 1305 int iIndex; /* index into the handle table */ 1306 BOOL fResult; /* result from the device handler's CloseHandle() */ 1307 PHMHANDLE pHMHandle; /* pointer to the handle structure in the table */ 1308 1309 /* validate handle */ 1310 iIndex = _HMHandleQuery(hObject); /* get the index */ 1311 if (-1 == iIndex) /* error ? */ 1312 { 1313 SetLastError(ERROR_INVALID_HANDLE); /* set win32 error information */ 1314 return (FALSE); /* signal failure */ 1315 } 1316 1317 pHMHandle = &TabWin32Handles[iIndex]; /* call device handler */ 1318 1319 //Handle information is stored in the handle structure; return it here 1320 if(lpdwFlags) { 1321 *lpdwFlags = pHMHandle->hmHandleData.dwHandleInformation; 1322 } 1323 1324 SetLastError(ERROR_SUCCESS); 1325 return TRUE; /* deliver return code */ 1326 } 1327 1328 /***************************************************************************** 1329 * Name : BOOL HMSetHandleInformation 1330 * Purpose : The SetHandleInformation function sets certain properties of an 1331 * object handle. The information is specified as a set of bit flags. 1332 * Parameters: HANDLE hObject handle to an object 1333 * DWORD dwMask specifies flags to change 1334 * DWORD dwFlags specifies new values for flags 1335 * Variables : 1336 * Result : TRUE / FALSE 1337 * Remark : 1338 * Status : 1339 * 1340 * Author : SvL 1341 *****************************************************************************/ 1342 BOOL HMSetHandleInformation (HANDLE hObject, 1343 DWORD dwMask, 1344 DWORD dwFlags) 1345 { 1346 int iIndex; /* index into the handle table */ 1347 BOOL fResult; /* result from the device handler's CloseHandle() */ 1348 PHMHANDLE pHMHandle; /* pointer to the handle structure in the table */ 1349 1350 /* validate handle */ 1351 iIndex = _HMHandleQuery(hObject); /* get the index */ 1352 if (-1 == iIndex) /* error ? */ 1353 { 1354 SetLastError(ERROR_INVALID_HANDLE); /* set win32 error information */ 1355 return (FALSE); /* signal failure */ 1356 } 1357 1358 pHMHandle = &TabWin32Handles[iIndex]; /* call device handler */ 1359 //SvL: Check if pDeviceHandler is set 1360 if (pHMHandle->pDeviceHandler) 1361 { 1362 fResult = pHMHandle->pDeviceHandler->SetHandleInformation(&pHMHandle->hmHandleData, 1363 dwMask, dwFlags); 1364 } 1365 else 1366 { 1367 dprintf(("HMSetHandleInformation(%08xh): pDeviceHandler not set", hObject)); 1368 fResult = TRUE; 1369 } 1370 1371 if(fResult == TRUE) { 1372 SetLastError(ERROR_SUCCESS); 1373 } 1374 return (fResult); /* deliver return code */ 1375 } 1289 1376 1290 1377 /***************************************************************************** … … 1324 1411 1325 1412 pHMHandle = &TabWin32Handles[iIndex]; /* call device handler */ 1413 1414 if(pHMHandle->hmHandleData.dwHandleInformation & HANDLE_FLAG_PROTECT_FROM_CLOSE) { 1415 dprintf(("Handle not close because of HANDLE_FLAG_PROTECT_FROM_CLOSE")); 1416 SetLastError(ERROR_SUCCESS); 1417 return TRUE; 1418 } 1419 1326 1420 //SvL: Check if pDeviceHandler is set 1327 1421 if (pHMHandle->pDeviceHandler) -
trunk/src/kernel32/KERNEL32.CPP
r7929 r9653 1 /* $Id: KERNEL32.CPP,v 1.7 2 2002-02-15 20:15:54sandervl Exp $ */1 /* $Id: KERNEL32.CPP,v 1.73 2003-01-10 12:57:12 sandervl Exp $ */ 2 2 3 3 /* … … 53 53 54 54 55 /***************************************************************************** 56 * Name : DWORD GetHandleInformation 57 * Purpose : The GetHandleInformation function obtains information about certain 58 * properties of an object handle. The information is obtained as a set of bit flags. 59 * Parameters: HANDLE hObject 60 * LPDWORD lpdwFlags 61 * Variables : 62 * Result : TRUE / FALSE 63 * Remark : 64 * Status : 65 * 66 * Author : SvL 67 *****************************************************************************/ 68 69 BOOL WIN32API GetHandleInformation(HANDLE hObject, 70 LPDWORD lpdwFlags) 71 { 72 return HMGetHandleInformation(hObject, lpdwFlags); 73 } 74 75 /***************************************************************************** 76 * Name : BOOL SetHandleInformation 77 * Purpose : The SetHandleInformation function sets certain properties of an 78 * object handle. The information is specified as a set of bit flags. 79 * Parameters: HANDLE hObject handle to an object 80 * DWORD dwMask specifies flags to change 81 * DWORD dwFlags specifies new values for flags 82 * Variables : 83 * Result : TRUE / FALSE 84 * Remark : 85 * Status : 86 * 87 * Author : SvL 88 *****************************************************************************/ 89 90 BOOL WIN32API SetHandleInformation(HANDLE hObject, 91 DWORD dwMask, 92 DWORD dwFlags) 93 { 94 return HMSetHandleInformation(hObject, dwMask, dwFlags); 95 } 55 96 /***************************************************************************** 56 97 * Name : BOOL WIN32API CloseHandle -
trunk/src/kernel32/hmdevice.cpp
r8401 r9653 1 /* $Id: hmdevice.cpp,v 1.3 2 2002-05-10 14:55:11sandervl Exp $ */1 /* $Id: hmdevice.cpp,v 1.33 2003-01-10 12:57:12 sandervl Exp $ */ 2 2 3 3 /* … … 200 200 { 201 201 dprintf(("KERNEL32:HandleManager::CloseHandle %s(%08x) - stub?\n", 202 lpHMDeviceName, 203 pHMHandleData)); 204 205 SetLastError(ERROR_INVALID_FUNCTION); 206 return FALSE; 207 } 208 209 /***************************************************************************** 210 * Name : BOOL HMSetHandleInformation 211 * Purpose : The SetHandleInformation function sets certain properties of an 212 * object handle. The information is specified as a set of bit flags. 213 * Parameters: HANDLE hObject handle to an object 214 * DWORD dwMask specifies flags to change 215 * DWORD dwFlags specifies new values for flags 216 * Variables : 217 * Result : TRUE / FALSE 218 * Remark : 219 * Status : 220 * 221 * Author : SvL 222 *****************************************************************************/ 223 BOOL HMDeviceHandler::SetHandleInformation(PHMHANDLEDATA pHMHandleData, 224 DWORD dwMask, 225 DWORD dwFlags) 226 { 227 dprintf(("KERNEL32:HandleManager::SetHandleInformation %s(%08x) - stub?\n", 202 228 lpHMDeviceName, 203 229 pHMHandleData)); -
trunk/src/kernel32/hmdevice.h
r7549 r9653 1 /* $Id: hmdevice.h,v 1.3 2 2001-12-05 14:16:00sandervl Exp $ */1 /* $Id: hmdevice.h,v 1.33 2003-01-10 12:57:13 sandervl Exp $ */ 2 2 3 3 /* … … 55 55 DWORD dwUserData; 56 56 DWORD dwInternalType; 57 DWORD dwHandleInformation; /* Set by SetHandleInformation */ 57 58 58 59 LPVOID lpHandlerData; /* for private use of the device handler */ … … 114 115 /* this is a handler method for calls to CloseHandle() */ 115 116 virtual BOOL CloseHandle(PHMHANDLEDATA pHMHandleData); 117 118 virtual BOOL SetHandleInformation(PHMHANDLEDATA pHMHandleData, 119 DWORD dwMask, 120 DWORD dwFlags); 116 121 117 122 /* this is a handler method for calls to ReadFile/Ex */ -
trunk/src/kernel32/hmfile.cpp
r9530 r9653 1 /* $Id: hmfile.cpp,v 1.3 7 2002-12-19 12:55:27sandervl Exp $ */1 /* $Id: hmfile.cpp,v 1.38 2003-01-10 12:57:13 sandervl Exp $ */ 2 2 3 3 /* … … 351 351 { 352 352 memcpy(pHMHandleData, &duphdata, sizeof(duphdata)); 353 354 if(fInherit) SetHandleInformation(pHMHandleData, ~HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); 355 353 356 SetLastError(ERROR_SUCCESS); 354 357 return TRUE; … … 368 371 if (rc) 369 372 { 370 dprintf(("ERROR: DulicateHandle: OSLibDosDupHandle(%s) failed = %u\n", 371 rc, 372 srcfileinfo->lpszFileName)); 373 dprintf(("ERROR: DuplicateHandle: OSLibDosDupHandle(%s) failed = %u", 374 srcfileinfo->lpszFileName, rc)); 373 375 SetLastError(rc); 374 376 return FALSE; // ERROR 375 377 } 376 378 else { 379 if(fInherit) SetHandleInformation(pHMHandleData, ~HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); 380 377 381 SetLastError(ERROR_SUCCESS); 378 382 pHMHandleData->hHMHandle = *desthandle; … … 386 390 return FALSE; 387 391 } 392 } 393 394 /***************************************************************************** 395 * Name : BOOL HMDeviceFileClass::SetHandleInformation 396 * Purpose : The SetHandleInformation function sets certain properties of an 397 * object handle. The information is specified as a set of bit flags. 398 * Parameters: HANDLE hObject handle to an object 399 * DWORD dwMask specifies flags to change 400 * DWORD dwFlags specifies new values for flags 401 * Variables : 402 * Result : TRUE / FALSE 403 * Remark : 404 * Status : 405 * 406 * Author : SvL 407 *****************************************************************************/ 408 BOOL HMDeviceFileClass::SetHandleInformation(PHMHANDLEDATA pHMHandleData, 409 DWORD dwMask, 410 DWORD dwFlags) 411 { 412 DWORD rc; 413 414 pHMHandleData->dwHandleInformation &= ~dwMask; 415 pHMHandleData->dwHandleInformation |= (dwFlags & dwMask); 416 417 rc = OSLibDosSetFHState(pHMHandleData->hHMHandle, 418 pHMHandleData->dwHandleInformation); 419 if (rc) 420 { 421 dprintf(("ERROR: SetHandleInformation: OSLibDosSetFHState failed with %d", rc)); 422 423 SetLastError(rc); 424 return FALSE; 425 } 426 427 SetLastError(ERROR_SUCCESS); 428 return TRUE; 388 429 } 389 430 -
trunk/src/kernel32/hmfile.h
r7549 r9653 1 /* $Id: hmfile.h,v 1. 7 2001-12-05 14:16:01sandervl Exp $ */1 /* $Id: hmfile.h,v 1.8 2003-01-10 12:57:13 sandervl Exp $ */ 2 2 3 3 /* … … 64 64 DWORD fdwOptions, 65 65 DWORD fdwOdinOptions); 66 67 virtual BOOL SetHandleInformation(PHMHANDLEDATA pHMHandleData, 68 DWORD dwMask, 69 DWORD dwFlags); 66 70 67 71 /* this is a handler method for calls to CloseHandle() */ -
trunk/src/kernel32/oslibdos.cpp
r9530 r9653 1 /* $Id: oslibdos.cpp,v 1.11 0 2002-12-19 12:55:27sandervl Exp $ */1 /* $Id: oslibdos.cpp,v 1.111 2003-01-10 12:57:13 sandervl Exp $ */ 2 2 /* 3 3 * Wrappers for OS/2 Dos* API … … 430 430 HFILE hFile; 431 431 ULONG ulAction; 432 DWORD os2flags = OPEN_FLAGS_NOINHERIT; 432 DWORD os2flags = OPEN_FLAGS_NOINHERIT; //default is not inherited by child processes 433 433 char lOemFileName[260]; 434 434 … … 843 843 ULONG fileAttr = FILE_NORMAL; 844 844 ULONG openFlag = 0; 845 ULONG openMode = 0;845 ULONG openMode = OPEN_FLAGS_NOINHERIT; //default is not inherited by child processes 846 846 APIRET rc = ERROR_NOT_ENOUGH_MEMORY;; 847 847 … … 1020 1020 ULONG fileAttr = FILE_NORMAL; 1021 1021 ULONG openFlag = 0; 1022 ULONG openMode = 0;1022 ULONG openMode = OPEN_FLAGS_NOINHERIT; //default is not inherited by child processes 1023 1023 APIRET rc = ERROR_NOT_ENOUGH_MEMORY; 1024 1024 HFILE hFile; … … 1471 1471 } 1472 1472 //****************************************************************************** 1473 //****************************************************************************** 1474 DWORD OSLibDosSetFHState(DWORD hFile, DWORD dwFlags) 1475 { 1476 DWORD ulMode; 1477 APIRET rc; 1478 1479 rc = DosQueryFHState(hFile, &ulMode); 1480 if(rc != NO_ERROR) return error2WinError(rc); 1481 1482 //turn off non-participating bits 1483 ulMode &= 0x7F88; 1484 1485 if(dwFlags & HANDLE_FLAG_INHERIT_W) { 1486 ulMode &= ~OPEN_FLAGS_NOINHERIT; 1487 } 1488 else 1489 ulMode |= OPEN_FLAGS_NOINHERIT; 1490 1491 rc = DosSetFHState(hFile, ulMode); 1492 return error2WinError(rc); 1493 } 1494 //****************************************************************************** 1473 1495 //Returns time spent in kernel & user mode in milliseconds 1474 1496 //****************************************************************************** … … 1515 1537 DWORD nDefaultTimeOut, 1516 1538 LPSECURITY_ATTRIBUTES lpSecurityAttributes) 1517 { DWORD dwOS2Mode = 0;1539 { DWORD dwOS2Mode = NP_NOINHERIT; //default is not inherited by child processes 1518 1540 DWORD dwOS2PipeMode = 0; 1519 1541 LPSTR lpOS2Name; … … 1574 1596 rc = DosOpen(lpOS2Name, &hPipe, &ulAction, 0, FILE_NORMAL, FILE_OPEN, 1575 1597 ((dwOpenMode & PIPE_ACCESS_INBOUND_W) ? OPEN_ACCESS_READWRITE : OPEN_ACCESS_READONLY) | 1576 OPEN_SHARE_DENYNONE , NULL);1598 OPEN_SHARE_DENYNONE | OPEN_FLAGS_NOINHERIT, NULL); 1577 1599 1578 1600 if(rc == NO_ERROR) { … … 1646 1668 ULONG rc, ulAction; 1647 1669 ULONG openFlag = 0; 1648 ULONG openMode = 0;1670 ULONG openMode = OPEN_FLAGS_NOINHERIT; //default is not inherited by child processes 1649 1671 1650 1672 … … 2609 2631 if (DosOpen("\\DEV\\CD-ROM2$", &hCDRom2, &ulAction, 0, 2610 2632 FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, 2611 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY , NULL)2633 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY | OPEN_FLAGS_NOINHERIT, NULL) 2612 2634 == NO_ERROR) 2613 2635 { … … 2864 2886 if (DosOpen("\\DEV\\CD-ROM2$", &hCDRom2, &ulAction, 0, 2865 2887 FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, 2866 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY , NULL)2888 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY | OPEN_FLAGS_NOINHERIT, NULL) 2867 2889 == NO_ERROR) 2868 2890 { -
trunk/src/kernel32/oslibdos.h
r9617 r9653 1 /* $Id: oslibdos.h,v 1.5 0 2003-01-05 12:31:24 sandervl Exp $ */1 /* $Id: oslibdos.h,v 1.51 2003-01-10 12:57:14 sandervl Exp $ */ 2 2 3 3 /* … … 113 113 114 114 DWORD OSLibDosDupHandle(DWORD hFile, DWORD *hNew); 115 DWORD OSLibDosSetFHState(DWORD hFile, DWORD dwFlags); 116 115 117 DWORD OSLibDosSetFilePtr2(DWORD hFile, DWORD offset, DWORD method); 116 118 -
trunk/src/kernel32/stubs.cpp
r7555 r9653 1 /* $Id: stubs.cpp,v 1.3 6 2001-12-06 10:14:45sandervl Exp $1 /* $Id: stubs.cpp,v 1.37 2003-01-10 12:57:14 sandervl Exp $ 2 2 * 3 3 * Win32 KERNEL32 Subsystem for OS/2 … … 870 870 871 871 872 /*****************************************************************************873 * Name : DWORD GetHandleInformation874 * Purpose : The GetHandleInformation function obtains information about certain875 * properties of an object handle. The information is obtained as a set of bit flags.876 * Parameters: HANDLE hObject877 * LPDWORD lpdwFlags878 * Variables :879 * Result : TRUE / FALSE880 * Remark :881 * Status : UNTESTED STUB882 *883 * Author : Patrick Haller [Mon, 1998/06/15 08:00]884 *****************************************************************************/885 886 BOOL WIN32API GetHandleInformation(HANDLE hObject,887 LPDWORD lpdwFlags)888 {889 dprintf(("KERNEL32: GetHandleInformation (%08xh, %08xh) not implemented\n",890 hObject,891 lpdwFlags));892 893 return (FALSE);894 }895 896 897 898 872 899 873 /***************************************************************************** … … 1356 1330 } 1357 1331 1358 1359 /*****************************************************************************1360 * Name : BOOL SetHandleInformation1361 * Purpose : The SetHandleInformation function sets certain properties of an1362 * object handle. The information is specified as a set of bit flags.1363 * Parameters: HANDLE hObject handle to an object1364 * DWORD dwMask specifies flags to change1365 * DWORD dwFlags specifies new values for flags1366 * Variables :1367 * Result : TRUE / FALSE1368 * Remark :1369 * Status : UNTESTED STUB1370 *1371 * Author : Patrick Haller [Mon, 1998/06/15 08:00]1372 *****************************************************************************/1373 1374 BOOL WIN32API SetHandleInformation(HANDLE hObject,1375 DWORD dwMask,1376 DWORD dwFlags)1377 {1378 dprintf(("KERNEL32: SetHandleInformation(%08xh,%08xh,%08xh) not implemented.\n",1379 hObject,1380 dwMask,1381 dwFlags));1382 1383 return (FALSE);1384 }1385 1386 1332 /***************************************************************************** 1387 1333 * Name : BOOL SetSystemPowerState
Note:
See TracChangeset
for help on using the changeset viewer.