Changeset 10132 for trunk/src/kernel32/HandleManager.cpp
- Timestamp:
- Jun 2, 2003, 6:25:36 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/HandleManager.cpp
r10109 r10132 1 /* $Id: HandleManager.cpp,v 1.10 3 2003-05-23 13:53:42sandervl Exp $ */1 /* $Id: HandleManager.cpp,v 1.104 2003-06-02 16:25:15 sandervl Exp $ */ 2 2 3 3 /* … … 4523 4523 * Author : Przemyslaw Dobrowolski 4524 4524 *****************************************************************************/ 4525 DWORDHMCreateNamedPipe(LPCTSTR lpName,4525 HANDLE HMCreateNamedPipe(LPCTSTR lpName, 4526 4526 DWORD dwOpenMode, 4527 4527 DWORD dwPipeMode, … … 4546 4546 { 4547 4547 SetLastError(ERROR_NOT_ENOUGH_MEMORY); /* use this as error message */ 4548 return 0;4548 return INVALID_HANDLE_VALUE; 4549 4549 } 4550 4550 … … 4575 4575 { 4576 4576 TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE; 4577 return 0;/* signal error */4577 return INVALID_HANDLE_VALUE; /* signal error */ 4578 4578 } 4579 4579 … … 4820 4820 4821 4821 /***************************************************************************** 4822 * Name : HMCreatePipe4823 * Purpose :4824 * Parameters:4825 * Variables :4826 * Result :4827 * Remark :4828 * Status : NOT TESTED!4829 *4830 * Author : Przemyslaw Dobrowolski4831 *****************************************************************************/4832 BOOL HMCreatePipe(PHANDLE phRead,4833 PHANDLE phWrite,4834 LPSECURITY_ATTRIBUTES lpsa,4835 DWORD cbPipe)4836 {4837 int iIndex; /* index into the handle table */4838 int iIndexNewRead; /* index into the handle table */4839 int iIndexNewWrite; /* index into the handle table */4840 HMDeviceHandler *pDeviceHandler; /* device handler for this handle */4841 PHMHANDLEDATA pHMHandleData;4842 HANDLE rc; /* API return code */4843 4844 SetLastError(ERROR_SUCCESS);4845 4846 pDeviceHandler = HMGlobals.pHMNamedPipe; /* device is predefined */4847 4848 iIndexNewRead = _HMHandleGetFree(); /* get free handle */4849 if (-1 == iIndexNewRead) /* oops, no free handles ! */4850 {4851 SetLastError(ERROR_NOT_ENOUGH_MEMORY); /* use this as error message */4852 return 0;4853 }4854 4855 iIndexNewWrite = _HMHandleGetFree(); /* get free handle */4856 if (-1 == iIndexNewWrite) /* oops, no free handles ! */4857 {4858 HMHandleFree(iIndexNewRead);4859 SetLastError(ERROR_NOT_ENOUGH_MEMORY); /* use this as error message */4860 return 0;4861 }4862 4863 4864 /* initialize the complete HMHANDLEDATA structure */4865 pHMHandleData = &TabWin32Handles[iIndexNewRead].hmHandleData;4866 pHMHandleData->dwAccess = 0;4867 pHMHandleData->dwShare = 0;4868 pHMHandleData->dwCreation = 0;4869 pHMHandleData->dwFlags = 0;4870 pHMHandleData->lpHandlerData = NULL;4871 4872 /* we've got to mark the handle as occupied here, since another device */4873 /* could be created within the device handler -> deadlock */4874 4875 /* write appropriate entry into the handle table if open succeeded */4876 TabWin32Handles[iIndexNewRead].hmHandleData.hHMHandle = iIndexNewRead;4877 TabWin32Handles[iIndexNewRead].pDeviceHandler = pDeviceHandler;4878 4879 /* initialize the complete HMHANDLEDATA structure */4880 pHMHandleData = &TabWin32Handles[iIndexNewWrite].hmHandleData;4881 pHMHandleData->dwAccess = 0;4882 pHMHandleData->dwShare = 0;4883 pHMHandleData->dwCreation = 0;4884 pHMHandleData->dwFlags = 0;4885 pHMHandleData->lpHandlerData = NULL;4886 4887 /* we've got to mark the handle as occupied here, since another device */4888 /* could be created within the device handler -> deadlock */4889 4890 /* write appropriate entry into the handle table if open succeeded */4891 TabWin32Handles[iIndexNewWrite].hmHandleData.hHMHandle = iIndexNewWrite;4892 TabWin32Handles[iIndexNewWrite].pDeviceHandler = pDeviceHandler;4893 /* call the device handler */4894 4895 rc = pDeviceHandler->CreatePipe(&TabWin32Handles[iIndexNewRead].hmHandleData,4896 &TabWin32Handles[iIndexNewWrite].hmHandleData,4897 lpsa,4898 cbPipe);4899 4900 if (rc == 0) /* oops, creation failed within the device handler */4901 {4902 HMHandleFree(iIndexNewRead);4903 HMHandleFree(iIndexNewWrite);4904 return FALSE; /* signal error */4905 }4906 4907 dprintf(("Read pipe %x, Write pipe %x", iIndexNewRead, iIndexNewWrite));4908 if(lpsa && lpsa->bInheritHandle) {4909 dprintf(("Set inheritance for child processes"));4910 HMSetHandleInformation(iIndexNewRead, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);4911 HMSetHandleInformation(iIndexNewWrite, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);4912 }4913 4914 *phRead = iIndexNewRead;4915 *phWrite = iIndexNewWrite;4916 4917 return TRUE;4918 }4919 4920 /*****************************************************************************4921 4822 * Name : HMCreateMailslotA 4922 4823 * Purpose :
Note:
See TracChangeset
for help on using the changeset viewer.