- Joined
- Aug 11, 2008
- Messages
- 1
- Reaction score
- 0
Hi All,
Please bear with me as I'm not well versed with driver development.
I have a composite device which exposes COM port driver and another NDIS driver. COM port driver is an existing driver which responds to AT commands. I need to access this COM port from NDIS driver.
I am Getting the Device interface by IoGetDeviceInterface and then trying to get the handle to COM port by calling zwcreatefile. I am getting the error code as STATUS_ACCESS_VIOLATION.
Following is my code, Please tell me if i had made a mistake anywhere.
status = IoGetDeviceInterfaces
(
(GUID*)GUID_DEVINTERFACE_COMPORT,
NULL,
0,
&pDevList
);
RtlUnicodeString(&ucValName, pDevList);
Initializeattributes
(
&ObjAttr,
&ucValName,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL,
);
status = ZwCreateFile
(
&pComHandle,
GENERIC_READ,
&ObjAttr,
&IoStatus,
FILE_ATTRIBUTES_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL,
0
);
The status returned is STATUS_ACCESS_VIOLATION.
I also tried to get the Object pointer by calling
status = IopGetDeviceObjectPointer
(
&ucValName,
GENERIC_READ,
&pFileObj,
&pDevObj,
);
I am able to get the proper file object and device object in this case. I want to know what is the mistake i am doing while calling ZwCreatefile.
Please bear with me as I'm not well versed with driver development.
I have a composite device which exposes COM port driver and another NDIS driver. COM port driver is an existing driver which responds to AT commands. I need to access this COM port from NDIS driver.
I am Getting the Device interface by IoGetDeviceInterface and then trying to get the handle to COM port by calling zwcreatefile. I am getting the error code as STATUS_ACCESS_VIOLATION.
Following is my code, Please tell me if i had made a mistake anywhere.
status = IoGetDeviceInterfaces
(
(GUID*)GUID_DEVINTERFACE_COMPORT,
NULL,
0,
&pDevList
);
RtlUnicodeString(&ucValName, pDevList);
Initializeattributes
(
&ObjAttr,
&ucValName,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL,
);
status = ZwCreateFile
(
&pComHandle,
GENERIC_READ,
&ObjAttr,
&IoStatus,
FILE_ATTRIBUTES_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL,
0
);
The status returned is STATUS_ACCESS_VIOLATION.
I also tried to get the Object pointer by calling
status = IopGetDeviceObjectPointer
(
&ucValName,
GENERIC_READ,
&pFileObj,
&pDevObj,
);
I am able to get the proper file object and device object in this case. I want to know what is the mistake i am doing while calling ZwCreatefile.