Read a file in driver
Hi,
I've written a function to read a file and copy its data to a buffer in the
non paged pool. But I can get nothing after a KsRead() call. All the
returned value are STATUS_SUCCESS. It's qutie strange.
My code is as following:
NTSTATUS
ReadMyFile(
IN PWCHAR FileName
)
{
NTSTATUS status;
IO_STATUS_BLOCK ioStatusBlock;
UNICODE_STRING fileNameString;
OBJECT_ATTRIBUTES objectAttributes;
ACCESS_MASK desiredHandleAccess;
ACCESS_MASK desiredObjectAccess;
ULONG ulShareAccess;
ULONG ulDisposition;
FILE_STANDARD_INFORMATION StandardInformation;
HANDLE hFile = NULL;
FILE_OBJECT *pFileObject = NULL;
//
// Attempt to open the file based on the access rights of the caller.
// Note that the SYNCHRONIZE flag must be set on the Create even
// though this is contained in the translated GENERIC_READ attributes.
// This is because the bit is tested before the Generic attributes
// are translated. This filter only does synchronous I/O on stream
// Read requests.
//
RtlInitUnicodeString(&fileNameString, FileName);
InitializeObjectAttributes(
&objectAttributes,
&fileNameString,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
//
// Set the access desired based on the type of filter which was
// actually created.
//
desiredHandleAccess = GENERIC_READ | SYNCHRONIZE;
desiredObjectAccess = FILE_READ_DATA;
ulShareAccess = FILE_SHARE_READ;
ulDisposition = FILE_OPEN;
status = IoCreateFile(&hFile,
desiredHandleAccess,
&objectAttributes,
&ioStatusBlock,
NULL,
0,
ulShareAccess,
ulDisposition,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0,
CreateFileTypeNone,
NULL,
IO_FORCE_ACCESS_CHECK | IO_NO_PARAMETER_CHECKING);
if ( !NT_SUCCESS(status) ) {
goto error;
}
status = ObReferenceObjectByHandle(hFile,
desiredObjectAccess,
*IoFileObjectType,
ExGetPreviousMode(),
reinterpret_cast<void
**>(&pFileObject),
NULL);
if ( !NT_SUCCESS(status) ) {
goto error;
}
if (m_pFileBuffer != NULL) {
ExFreePool(m_pFileBuffer);
m_pFileBuffer = NULL;
}
m_ulFileBufferSize = 0;
//
// retrieve file's size
//
status = KsQueryInformationFile(pFileObject,
&StandardInformation,
sizeof(StandardInformation),
FileStandardInformation);
if ( !NT_SUCCESS(status) || StandardInformation.EndOfFile.QuadPart >
MAXLONG ) {
goto error;
}
else {
ULONG m_ulFileBufferSize =
(LONG)(StandardInformation.EndOfFile.QuadPart);
}
//
// allocate a buffer to hold file's content
//
m_pFileBuffer = (BYTE*)ExAllocatePoolWithTag(NonPagedPool,
m_ulFileBufferSize,
NULL);
if ( m_pFileBuffer == NULL ) {
status = STATUS_INSUFFICIENT_RESOURCES;
goto error;
}
DbgPrint("(1) Bitmap data is %02X %02X %02X %02X",
*m_pFileBuffer, *(m_pFileBuffer + 1), *(m_pFileBuffer + 2),
*(m_pFileBuffer + 3));
//
// read file's content to buffer
//
status = KsReadFile(pFileObject,
NULL,
NULL,
&ioStatusBlock,
m_pFileBuffer,
m_ulFileBufferSize,
0,
KernelMode);
if (NT_SUCCESS(status))
{
DbgPrint("(1) Bitmap data is %02X %02X %02X %02X",
*m_pFileBuffer, *(m_pFileBuffer + 1), *(m_pFileBuffer + 2),
*(m_pFileBuffer + 3));
}
error:
if ( !NT_SUCCESS(status) && m_pFileBuffer != NULL ) {
ExFreePool(m_pFileBuffer);
m_pFileBuffer = NULL;
}
if ( pFileObject != NULL ) {
ObDereferenceObject(pFileObject);
}
if ( hFile != NULL ) {
ZwClose(hFile);
}
return status;
} Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40887
Detecting Print-to-File option from a printer driver plugin DLL
Do anyone know how to detect Print-to-File option from a printer driver plugin DLL
I like to be able to do this in Win9x, WinNT, Win2k and WinXP. Your advice is highl
appreciated
Thanks
Anthony Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40884
Mirror Drv, EngDeviceIoControl problem
This is a multi-part message in MIME format.
------=_NextPart_000_000D_01C3FCCD.814DCA40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I am writing a mirror display drive, I am tring to communicate between =
the Display driver and the miniport driver using EngDeviceIoControl, BUT =
of some strange reason when the mimiport gets the HwStartIO request =
'RequestPacket->OutputBuffer' has a pointer different then the one =
passed through the EngDeviceIoControl call, when the EngDeviceIoControl =
returns ( after the MirrorStartIO took place ) the content of the Output =
buffer doesn't change ( although it was update in the Miniports =
HwStartIO request ). What may cause this problem?
The Display Driver code:
****************************
DHPDEV DrvEnablePDEV( .... )
{
...
DWORD dwDataPtr=3D 0;
DWORD dwRetBytes =3D 0;
DWORD dwRet =3D EngDeviceIoControl( hDriver, IOCTL_MIRROR_GET_SHM, NULL, =
0, &dwDataPtr, sizeof(dwDataPtr), &dwRetBytes);
...
}
The miniport code:
*********************
UserModeMem_t g_SharedMemory =3D { 0 };
BOOLEAN MirrorStartIO(
PVOID HwDeviceExtension,
PVIDEO_REQUEST_PACKET RequestPacket
)
{
VideoDebugPrint((Trace,"StartIO Called.\n"));
switch(RequestPacket->IoControlCode)
{
case IOCTL_MIRROR_GET_SHM:
VideoDebugPrint((Trace,"IOCTL_MIRROR_GET_SHM =3D=3D =
RequestPacket->IoControlCode.\n"));
RequestPacket->StatusBlock->Status =3D NO_ERROR;
*(unsigned long*)RequestPacket->OutputBuffer =3D (unsigned =
long)&g_SharedMemory;
RequestPacket->OutputBufferLength =3D sizeof(&g_SharedMemory);
break;
}
return TRUE;
}
Thanks,
Nadav.
------=_NextPart_000_000D_01C3FCCD.814DCA40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<P><FONT face=3DArial size=3D2>Hi,<BR><BR>I am writing a mirror display =
drive, I am=20
tring to communicate between the Display driver and the miniport driver =
using=20
EngDeviceIoControl, BUT of some strange reason when the mimiport gets =
the=20
HwStartIO request 'RequestPacket->OutputBuffer' has a pointer =
different then=20
the one passed through the EngDeviceIoControl call, when the =
EngDeviceIoControl=20
returns ( after the MirrorStartIO took place ) the content of the Output =
buffer=20
doesn't change ( although it was update in the Miniports HwStartIO =
request ).=20
What may cause this problem?</FONT></P>
<P><FONT face=3DArial size=3D2>The Display Driver=20
code:<BR>****************************</FONT></P>
<P><FONT face=3DArial size=3D2>DHPDEV DrvEnablePDEV( .... =
)<BR>{<BR>...<BR>DWORD=20
dwDataPtr=3D 0;<BR>DWORD dwRetBytes =3D 0;<BR>DWORD dwRet =3D=20
<STRONG>EngDeviceIoControl</STRONG>( hDriver, IOCTL_MIRROR_GET_SHM, =
NULL, 0,=20
&dwDataPtr, sizeof(dwDataPtr), =
&dwRetBytes);<BR>...<BR>}</FONT></P>
<P><FONT face=3DArial size=3D2></FONT> </P>
<P><FONT face=3DArial size=3D2>The miniport=20
code:<BR>*********************</FONT></P><FONT size=3D2>
<P>UserModeMem_t g_SharedMemory =3D { 0 };</P></FONT>
<P><FONT face=3DArial size=3D2>BOOLEAN MirrorStartIO(<BR> =
PVOID=20
HwDeviceExtension,<BR> PVIDEO_REQUEST_PACKET=20
RequestPacket<BR> =
)<BR>{<BR> VideoDebugPrint((Trace,"StartIO=20
Called.\n"));</FONT></P>
<P><FONT face=3DArial=20
size=3D2> switch(RequestPacket->IoControlCode)<BR> {<BR>&nbs=
p;case=20
IOCTL_MIRROR_GET_SHM:<BR> VideoDebugPrint((Trace,"IOCTL_MIRROR=
_GET_SHM=20
=3D=3D=20
RequestPacket->IoControlCode.\n"));<BR> RequestPacket->S=
tatusBlock->Status =3D=20
NO_ERROR;<BR> *(unsigned =
long*)RequestPacket->OutputBuffer =3D=20
(unsigned=20
long)&g_SharedMemory;<BR> RequestPacket->OutputBufferLe=
ngth =3D=20
sizeof(&g_SharedMemory);<BR> break;<BR> }</FONT></P>
<P><FONT face=3DArial size=3D2> return TRUE;<BR>}<BR></FONT></P>
<P><FONT face=3DArial size=3D2>Thanks,<BR> =
Nadav.</FONT><FONT face=3DArial=20
size=3D2></P></FONT></DIV></BODY></HTML>
------=_NextPart_000_000D_01C3FCCD.814DCA40-- Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40883
Writing storage device driver for a flash PCI card
Hello,
I have a PCI adapter that has flash memory on it. I know everythings about this card, including the PCI manuf device ID, the PCI config register, and how to read and write from/to the flash memory.
I want to write a driver for it such that when I open windows explorer I will see my card shown as drive D: (or E: if there is a CD rom in the system). I have been reading books, including Programming the MS WDM 2nd, Oney, and the DDK documentation from the lastest DDK for Window 2000/XP. Too much information has made me confused.
1. Should I write the SCSI mimiport driver that will layer below the scsi port driver?
I read about this SCSI miniport things but it's really confused. I have thought about this but when I look at the functions that I have to implement shown in the DDK, it is too complicated. My PCI card does not use DMA and IRQ. It only need two 32-bit registers and a 4k memory range and an IO port that is part of the PCI config space.
2. What are the alternatives?
Port driver? I thought my driver must be a port driver, since it must tell the system how to read and write to the PCI register. But it must contain a layer that tell the system that my drive is a D: drive.
Anyhow, this whole thing is a mess in me right now. Can someone explain or show me what the best approach to this? Thank you so very much.
Long Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40880
Keyboard mouse stream separation - again...
Hello folks,
again I am having a few questions belonging to my previous topics. I
want to separate keyboard and mouse streams originating from different
devices - Windows shall only get the information of one device combo.
The others shall be used for whatever.
I have written adopted DDK filter driver examples for PS/2 chain. This
works but is a bit dirty.
The DDK also contains the original "keyboard class" and "mouse class"
drivers. Wouldn´t it be possible to adopt them to deliver this
feature?
How are those driver examples installed? DDK help says that they are
protected by system driver protection... How can you prevent XP from
caring about those drivers?
Many thanks for your help...
Volker Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40878
BusFilter on XP
Hi,
I've just written a dummy pass-through bus filter that works fine on
Windows 2000 but on Windows XP crashes when ASPI driver sends a
request.
Has anyone of you met this problem ? Thanks.
Clark Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40869
International OEM Windows Driver Development
Introducing myself, I am a Windows custom Printer driver specialist,
background is as follows:
Seeing all these driver issues on this newsgroup would like to
introduce QualSoft..
- Develop Printer drivers for Printer manufacturers WorldWide,
- Developed drivers since 1995,
- Developed unique access to device functionality,
- Continue to work with OEM printer manufacturers Internationally
todate
- Continue to market Internationally for printer driver development
for OEM Windows Driver development,
- Specialist in Custom printer driver development for all Windows
versions,
- Specialist in development of Printer Monitors,
- Specialist in working to client's unique needs,
- Development for International OEM's
- Develop for all types of technology including laaer, line printer,
label printers, barcode printers.
With Best Regards,
Andy Headland
QualSoft Software Consultants Ltd
Tel: +44 (0)1969 624575
Fax: +44 (0)1969 624637
http://www.qualsoftsoftware.com
qualsoft_software@msn.com Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40868
WinPE and sbp2port
Hello,
I have a 1394 Storage device in WinPE.
When I try to reconnect the device in WinPE or if the
device was not connected on the boot, I get a problem
with the driver sbp2port.sys.
The service entry for the driver in the registry shows that INITSTARTFAILED
is 1.
The same device can be reconnected fine in Windows XP Professional SP1.
I use the same version of sbp2port.sys (5.1.2600.1106) in
both cases.
Any advices what and where to change in WinPE configuration?
Thank you.
SD. Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40866
srand() inkernel mode
Does anyone have a suggestion for seeding rand() in a kernel mode driver?
In user mode or application layer, it is common to srand(currenttime), but
the system time is not available in kernel mode.
Thank you. Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40864
Share memory between user mode and kernel mode
Hi
A windows application (user mode) create a memory area with CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,0,TAILLE_BUFFER,"SharingImage"
I want to use this area in a driver (kernel mode).
According to the Microsoft knowledge Base 191840. I have to use the following functions
- ZwOpenSection(
-ZwMapViewOfSection(
But I don't know how to get adress of the area
The source is
RtlInitUnicodeString(&ShareMemoryName,L"\\SharingImage")
InitializeObjectAttributes( &InitializedAttributes, &ShareMemoryName, OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, NULL, NULL)
status = ZwOpenSection( &pat_AcquisitionFile,SECTION_MAP_READ, &InitializedAttributes)
the return code is always
"STATUS_OBJECT_NAME_NOT_FOUND"
What can I do to point to the right are
Thanks
Pasca Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40854
Win98 unidriver/landscape mode banding
Is there anyway to get a vertical banded RGB data in Win98 unidriver ?
I set sPlanes=1, sBitsPerPixel=24, thus a fnOEMDump() function is
required.
Unidriver bands portait pages in printing direction, that's fine.
Problem raises when i print with landscape mode:
If i set MD_LANDSCAPE_GRX_ABLE in fGeneral, it will band landscape
page horizontally, which is not the printing direction.
If i clear MD_LANDSCAPE_GRX_ABLE in fGeneral, UniControl() returns
the whole page dimension at 1st time NEXTBAND was called, and returns
empty rect at 2nd time NEXTBAND was called. This is absolutely not
what we want. We'd like to have correct band rect(s) for landscape
mode.
Is there any solution for such condition in unidriver ? Or the only
way is to write my own driver ?
Thanks in advance. Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40853
PCMCIA and CIS Reading/Writing
Hi,
I succeed in reading the CIS of my PCMCIA card. I don't use
the kernel mode, sorry to post here, but perhaps someone could help
me.
I whould like to know where I can find the size of my CompcatFlash
memory car in the slot PCMCIA, using the CIS I just read, is it
possible to retreive the information.
Is it possible to WRITE in the CIS, in order to change on byte in the
name on the manufacturer in exemple??
thanks if you know that or if you have links for me?? Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40852
firewire delayed write failure
Hi everybody,
i have a problem with an external firewire hard disk. The problem is a
"Delayed Write Failure" when i try to read some kind of file (DV AVI
most of the time).
The root cause of the problem is explained at
http://www.bustrace.com/products/delayedwrite.htm.
On this page there is also a little test tool that is able to
reproduce the problem. The solution is to write a filter driver that
prevents IO larger than 128Kb to reach the drive.
Is there anyone able to write a filter driver like the one described
in the link and post it to the community?
thank you. Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40851
NDIS IM, Stream Interface
Hi Count Blackoth,
I am new for wince and IM driver, working on WINCE 4.2.
I am trying to load IM driver on WINCE 4.2 dynamically.
I have gone through all your communication with
microsoft.public.development.device.drivers
on the subject of NDIS IM, Stream Interface,PocketPC2002.
I am going in the same way and have same set of questions as you
had.
I found that your questions remained unanswered.
If you have found the solution , would you like to share with me ??
Can you guide me how should I write an stream interface for IM
driver and making it workable.
Any suggestion in this regard will be a great help for me.
regards,
Niraj Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40847
Normal newsgroup server
Hi
is the newsgroup available through normal newsgroup interface? I prefer my Netscape 7.1 newsgroup reader to the web one, however I can't find this particular newsgroup on my favorite servers. If it is available, where
Thanks. Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40845
1MHz interrupt
Hello,
I would like to write an application that would periodically write bytes to the parallel port with frequency ranging from several Hz to 1MHz. I thought I could use the hadrware timer to genearte interrupt every time and write a device driver to handle it. However, my first question is: Is it possible to accomplish it? I mean, is it possible to get such a high frequency reliable under Windows? will not my interrupts be delayed by task switching, other interrupts etc. Is it possible to disable task switching etc for a short time? Or would it be realiable at least in the case that no other applications run
Thank you very muc Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40844
create an event at ring0 level
Hi,
whats the way of creating an event at Ring0 level.I am using Win 98 OS.So
far i have got the information to create event at ring3 and convert it to
ring0 event.But i don't want to do that.I need to create event at ring0
level.How to do that.
Plz reply.
regds
vinay Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40840
SPTI rejects valid requests
I'm witing some low level CD access stuff (writing DAO in RAW mode and
things).
I'm mainly using SPTI, cos I'm developing under XP.
The problem I'm having is that a number of calls are failing for no apparent
reason.
These calls work perfectly when I use ASPI as the transport (I choose to use
ASPI or SPTI when my base level object is initialised - all the CDB
construction and so on are in higher levels and identical).
The 2 calls which I'm seeing give problems are Read TOC (ATIP) and ReadCD
(with a -ve LBA).
I've looked at the CDB and in both cases it is identical.
The errors I'm seeing are Address out of Range (for Read CD) and 'invalid
Operation for this track' for the ATIP reading.
I cannot believe that something in Windows is doing this. But on the other
hand, nor can I see anyting odd I'm doing with these particular functions.
The Object proper is quite happy to use dozens of other functions (including
ReadToc with other parameters!) and happily writes audio cds and DVDs and
reads the same. Just these few functions ...
Can ayone throw light on this?
Iain Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40839
any code on memory card reader driver and firm ware???
I want to develop a readerdriver that can support memorycard ,but feel
quite confused,has any one developed that before?could you share me
the LIB that replaces PC/SC ,if you can offer me some source code ,
It will be quite a great honor to me.
thanks in advance!!!!! Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40838
Map interface index from the IP Helper API to an intermediate driver miniport instance.
Hi!
Is there any way for an intermediate driver to find out (in either
ProtocolBindAdapter or MiniportInitialize) what interface index (IP Helper
API) it will get.
In userspace I keep track of adapter by their iphlp index and I would like
to make a call down an intermediate driver with that index instead of the
name of the adapter. It would be awesome if each of my miniports instances
could figure out that index on their own.
Cheers! Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40836
ISR not called
Iam writing a device driver for PCI card
Iam using a interrupt.
I have initialized the interrupt and connected the InterruptServiceRoutine
by the call IoConnectInterrupt.Also the DPC object is initialized for the
DpcForIsr routine by IoInitializeDpcRequest.
In the interrupt service routine
First checked for the interrupt whether it is from my card if it is not
returned FALSE immediately.
If it is from my card then acknoledged it. Then some processing is done.
Then the DPC object is queued to continue the request processing by
IoRequestDpc.
Return TRUE from the Interrupt Service routine.
When I debugged the program ISR routine is not called.
Am I doing any mistake.
Secondly when I restart the system, the system was hung.I think the problem
is due to not disabling the interrupts in correct way.What am I supposed to
do.
How to solve these problems?
thanks®ards
sobana.D Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40830
isr not called
Iam writing a device driver for PCI card
Iam using a interrupt.
I have initialized the interrupt and connected the InterruptServiceRoutine
by the call IoConnectInterrupt.Also the DPC object is initialized for the
DpcForIsr routine by IoInitializeDpcRequest.
In the interrupt service routine
First checked for the interrupt whether it is from my card if it is not
returned FALSE immediately.
If it is from my card then acknoledged it. Then some processing is done.
Then the DPC object is queued to continue the request processing by
IoRequestDpc.
Return TRUE from the Interrupt Service routine.
When I debugged the program ISR routine is not called.
Am I doing any mistake.
Secondly when I restart the system, the system was hung.I think the problem
is due to not disabling the interrupts in correct way.What am I supposed to
do.
How to solve these problems?
thanks®ards
sobana.D Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40829
ISR not called
Iam writing a device driver for PCI card
Iam using a interrupt.
I have initialized the interrupt and connected the InterruptServiceRoutine
by the call IoConnectInterrupt.Also the DPC object is initialized for the
DpcForIsr routine by IoInitializeDpcRequest.
In the interrupt service routine
First checked for the interrupt whether it is from my card if it is not
returned FALSE immediately.
If it is from my card then acknoledged it. Then some processing is done.
Then the DPC object is queued to continue the request processing by
IoRequestDpc.
Return TRUE from the Interrupt Service routine.
When I debugged the program ISR routine is not called.
Am I doing any mistake.
Secondly when I restart the system, the system was hung.I think the problem
is due to not disabling the interrupts in correct way.What am I supposed to
do.
How to solve these problems?
thanks®ards
sobana.D Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40828
ISR not called
Iam writing a device driver for PCI card
Iam using a interrupt.
I have initialized the interrupt and connected the InterruptServiceRoutine
by the call IoConnectInterrupt.Also the DPC object is initialized for the
DpcForIsr routine by IoInitializeDpcRequest.
In the interrupt service routine
First checked for the interrupt whether it is from my card if it is not
returned FALSE immediately.
If it is from my card then acknoledged it. Then some processing is done.
Then the DPC object is queued to continue the request processing by
IoRequestDpc.
Return TRUE from the Interrupt Service routine.
When I debugged the program ISR routine is not called.
Am I doing any mistake.
Secondly when I restart the system, the system was hung.I think the problem
is due to not disabling the interrupts in correct way.What am I supposed to
do.
How to solve these problems?
thanks®ards
sobana.D Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40827
UPS minidriver Dll
Hi
I'm currently developing a UPS minidriver Dll for Windows XP
The UPSTurnOff function has a parameter DWORD aTurnOffDelay
The DDK describes the parameter as
Specifies the minimum amount of time, in milliseconds, to wait before turning off the UPS unit's power outlets.
Called by the UPS service, I get here 180
Does this mean that I have to wait 180ms before issueing the output to the UPS to shut down
Does this mean that I have to issue the output 180ms long
It CANNOT mean that the UPS has to turn off 180ms after issuing the output because XP has no
even begun to shut down
I assume this value is in seconds. 180s seems to be an appropriate value for shutting down XP
Thanks for your help Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40819
OID problem
Hi,
I am developing a protocol driver. There I need to define my own WLAN OIDs.
How it can be done. I have a driver developer manual from a chipset
manufacturer. that chipset developer is providing some of his own OIDs. I am
on Windows 2000. thought chipset developer provides his OID header files but
as of now i don't have those. so thought if it is possible to write own
OIDs.
e.g. one of the OID provided by chipset manufacturer is OID_CURRENT_BSSID.
I have some info from Driver Developement Manual for miniport drivers.
Is there any way by which i can define these OID.
regards,
Puneet Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40813
DRIVER_OBJECT list
Hello All,
Is there a way to obtain the list of driver objects under 2K/XP?
Thanks,
Senthil Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40802
How can I lock user memory at DISPATCH_LEVEL?
Hi
My driver has to do lots of Scatter Gather List DMA operations. This used to be ok at PASSIVE_LEVEL, but it becomes a problem when I try to use a system queue and call DMA operation in my StartIo routine. Before I can start DMA operation, I need call IoAllocateMdl() to build MDL for the user memory and call MmProbeAndLockPaged() to lock the user memory into the physical pages. According to DDK document, MmProbeAndLockPages() function can be called at DISPATCH_LEVEL ONLY when the memory is not pagable, but I have no way to guarranttee that the user memory is nonpagable, right
Is there anyway I can get around this
Thanks
zhong Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40799
INF directive for amd64, intel 64bit extension
I could not find the directive for amd64 and intel 64bit extension used in INF
Currently, in DDK, following directives are defined
ntx86, ntia64 and nt
What's for amd64 and intel 64bit extension
Thanks
Yadong Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40796
multiple virtual COM port support over USB
I have a WinCE device that is able to connect to the PC via Active Sync over USB. It can also connect as a modem(but not at the same time). The drivers on the PC side for either of these expose a virtual COM port on the PC. I want to change my WinCE device side driver to add support for one more virtual COM port over the same USB connection. I have changed my device side descriptor to say it has two interfaces, but I'm having trouble enumerating two ports. Do the PC side drivers (wceusbsh.sys or usbser.sys) support enumerating multiple interfaces
Thanks for your hel Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40786
Creating a GUID in Kernel-mode
Does anybody have a code snippet that shows how to generate a GUID in a
kernel-mode driver?
Thank you Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40780
Windows Driver Development Company
Seeing all these queries, I thought you should all know about QualSoft
at http://www.qualsoftsoftware.com
Good quality driver developement services for OEM's and printer
manufacturers worldwide since 1995. Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40779
Problem using KeQuerySystemTime
My goal is to inject a job id into a PS header using WMARKPS compiled in
kernel-mode (for NT4.0). My development environment is WinXP Professional,
VC++6.0, Windows DDK 2600.1106.
1.. Using the 'DDK checked' shortcut (on the start menu):
1.. I typed "set WINNT_40=1"
2.. After moving to "
C:\DDK\WINDDK\2600.1106\src\print\oemdll\watermark_NT", I typed
"build -cef". (I copied the watermark folder to watermark_nt, and modified
the sources file so that watermarkps.dll would be compiled in kernel-mode).
3.. At this point I am able to install and use the NT version of WMARKUI
and WMARKPS on an NT4.0 system.
2.. From this point I want to simply inject a PS comment that consists of
a JOBID generated from the system time.
1.. In the PSCommand method of Command.cpp in WMARKPS I want to use
KeQuerySystemTime(), but when I compile, KeQuerySystemTime() causes an
undeclared identifier error.
2.. If I "#include <ntddk.h>" (or wdm.h), the compiler says that it can'
t find the header files.
3.. If I "#include < C:\DDK\WINDDK\2600.1106\inc\wxp\ntddk.h>", the
compiler gives me a bunch of redefinition errors.
4.. If I "#include < C:\DDK\NTDDK\inc\ntddk.h>", the compiler again
gives me a bunch of redefinition errors.
How can I get methods defined in NTDDK.H to compile?
Thank you,
Mike Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40771
IP Address Assignement Problem on WinME- A starnge one.
Hi,
I am facing a strange problem on WinME.
I am connecting two USB Network Devices on My system running WinME.
I assign x.y.z.1 address to first card (say Card1) and x.y.z.2 to second
card (say Card2).
Ping works on both the cards.
Now I remove both the cards and connect card2 first. What I see is that the
system has assigned x.y.z.1 address to this card2 and if I connect Card1
now the system assigns x.y.z.2 address to Card1.
(Actually we would expect the system to assign x.y.z.1 addres to Card1 and
x.y.z.2 to card2)
Why the system is behaving this way?
Is it any known issue on WInME or is there anything that I am missing in my
driver or in INF file.
Please help me in sorting out this issue.
thanking you in advance.
regards,
Nazim Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40770
CARDBUS-Card incorrectly enumerated as MTD-0002 Memory card
I tried to install a CARDBUS-Card in my Toshiba Satellite Pro 4320, with Win2K SP4 on it. When I inserted the card, it was recognized as the PCMCIA MTD-0002 memory card. All tries to install the correct driver failed. On other notebooks or desktops the card is recognized correctly. I also tried to update the bios, but without solving the MTD-0002-problem.
The used cardbus controller is a Toshiba ToPIC100
Thank you for your efforts
greeting Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40769
Microsoft Printer Language Monitor
Hello All:
The Story so far
----------------
I want to compress a PCL output file via a standard UNIDRV based
printer driver in w2k. I need to do this so that a compressed PCL file
is read by another custom tool which will extract and interpret the
PCL Data.
To do this, I need a language monitor with my unidrv based printer
driver. According to my picture, The story goes that the pcl data is
received in the language monitor from the print processor. The
language monitor will compress and send the data to microsoft's own
port monitor via the FILE port and the file is saved and compressed.
Problem:
--------
I have compiled Microsoft's own sample of a language monitor, namely
the pjlmon package but I only could do this if I change the following:
1: There is a case statement with a syntax error using a ';' instead
of ':'
2: The assignments to the function pointer types mismatch so I had to
create wrappers which match those in the MONITOREX structure used in
the sample.
I installed microsoft's language monitor successfully after some
hassle but I still have more issues. Namely:
1: I had to remove references to critical sections everywhere.
2: I had to remove a validation UpdateTimeoutsFromRegistry in the
InitializePrintMonitor.
My problem is that my WritePort in the sample is not being called. I
have included some file output traces to check for this.
I also see that in MSDN, docs state that InitializePrintMonitor2 is to
be used for language monitors. It is not the case in MS's own sample.
Does anyone have experience on MS Language Monitors who can shed a
light upon my problem please?
Thanks and Best Regards
Duncan Camilleri Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40767
DiskPerf Crashes.
Hi Guys
I am using Win XP Pro SP1 for developing a simple device driver.
As i am a beginner i wanted to test the DIskperf.sys provided in the DDK
kit.
I have two hard disks connected in my system say disk1 and disk2
disk2 is the secondary slave.
so i install the diskperf.sys in disk2 ..
as
addfilter /device \disk2 /add diskperf.sys
after that i restart the system
then i can see that my disk2 is not at all recognized.
To solve the problem i go to Device Manager,uninstall Disk2 and again do a
scan for plug and play hardware.
This seems to be a recurring problem.
Any help is awaited...
Expecting replies
Regards
Shalini Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40762
DbgPrint in Irql=2
I had a debug print in the Irql = DISPATCH_LEVEL when I acquired
spinlock. There was bug check "invalid address access at higher Irql,
Irql = 2".
I removed the print and I had no problem.
Is it DbgPrint should not be called after acquiring Spinlock(before
releasing lock) or my problem is just hidden. I know we should release
spinlock as soon as possible but I just had print (only for testing).
Is it bug to have print in spinlock. Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40760
The USBView in 2003 DDK can not work well on Windows 2k.
The new version of USBview can not work well on Windows 2k.
1.When build the usbview "using obsolete header file usbioctl.h".
2.Use it in Windows 2000 and Windows XP, Usbview can not show all the USB
device.
3.I have debug into it. It failed in
"IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX"(It is
"IOCTL_USB_GET_NODE_CONNECTION_INFORMATION" in old version.).
Did the new version of USBView can only work on Windows XP (with all the
needed update)? Is there any way to make the new USBView can work on other
system? Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40756
working with multiple OS versions
Hi All,
The question is at the end.
I have a PCI device + driver, which has to work on both Win-NT and
Win-2K.
I have 2 Drivers : A WDM driver for Win2K, and a Non-WDM driver for
Win-NT.
So, far everything is great.
The 2 drivers has the axact same interface from the application point
of
view. The only difference is in the "CreateFile() method". So,
naturally,
I want to have one DLL for both drivers, and do the CreateFile()
according to the runtime OS version.
This works also very good.
Here comes the problem :
Up until now, I compiled the DLL on Win-2K, and ran it under both OS.
Now, I want to compile this DLL, under Win-NT (I am not expecting to
run this DLL on win-2K). I am expecting to have one code though.
Now the following line does not compile !!!!
"include <initGuid.h>
The file axists, but I get some funny compilation error. Here I do not
care for the GUID (I CreateFile() by the good old NT method), so I
delete
this line and everything works. Remember that I am expecting to have
one
code for the DLL.
I want to do something like:
#if (WINVER > 0x0400)
"include <initGuid.h>
#endif
But for some reason, this does not work: On my Win-2K compilation
machine,
WINVER is also defined to be 0x0400.
***************************
So here comes the question :
How do I figgure out during compilation, which OS version I am
compiling on ?
I want to use some compiler variable.
Thanks
Maurice Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40754
KSPROPERTY_MEDIASEEKING_FORMATS / ksproxy!CKsProxy:QueryMediaSeekingFormats
Hi All,
In my continuing quest to implement IMediaSeeking in a stream class
minidriver, it seems that the ksproxy itself (and not a component aggregated
by it) will ask you which seeking formats you support (via
KSPROPERTY_MEDIASEEKING_FORMATS), if you support KSPROPSETID_MediaSeeking on
the device (and not on the pin/stream). However, I don't know where to stick
the answer. The DDK docs on this are sketchy to say the least.
I'm getting
pSrb->CommandData.PropertyInfo->PropertyInputSize = 18 (=
sizeof(KSPROPERTY))
pSrb->CommandData.PropertyInfo->PropertyOutputSize = 0
I've tried returning STATUS_BUFFER_TOO_SMALL (as per
SRB_GET_DATA_INTERSECTION) and/or STATUS_BUFFER_OVERFLOW, but when I do
that, I don't get any further requests. So, I tried returning
STATUS_SUCCESS, but that resulted in ksproxy reading from address 00000004.
Has anyone ever done anything with this? Max P?
thanks for ANY help,
Matt Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40753
Connecting to an USB-Device
Hi !!
I'm student of computer sciences in germany and work on a project in
which I want to build some generic classes to list all available USB-Devices
and to connect to any USB device. (Of course the developer has to know
how to access the driver)
I build a class to enumerate all USB devices and give it back as a list
(like the USBView Example in the DDK). Now I want to open
a connection to one of this devices.
For this I need the GUID (Or at least it seems so. I just looked at the
BulkUSB Example in the DDK),
but I can't find a way to get it from Windows only having the device data i
got from enumeration.
Do you know a possibility to do that ??
Or perhaps another way to open the device...
Or another way to get a list of all USB-Devices with their GUID...
Thx for ANY help.
Andre Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40752
SetupDiGetDeviceInterfaceDetail fails???
HDEVINFO devInf
SP_DEVICE_INTERFACE_DATA spData
SP_DEVINFO_DATA devInst
SP_DEVICE_INTERFACE_DETAIL_DATA t
t.cbSize=NULL
DWORD ers=offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA,DevicePath) + sizeof(TCHAR)
devInst.cbSize=sizeof(SP_DEVINFO_DATA);
spData.cbSize=sizeof(SP_DEVICE_INTERFACE_DATA); devInf=SetupDiCreateDeviceInfoList(NULL,NULL)
DWORD ertt=GetLastError()
BOOL rt2=SetupDiOpenDeviceInterface(devInf,g_hdID,0,&spData);PDWORD sz;//g_hdID is what I get in dev->dbcc_name through PnP(WM_DEVCHANGE
DWORD ert2t=GetLastError()
BOOL rt=SetupDiGetDeviceInterfaceDetail(devInf,&spData,&t,0,sz,&devInst)
DWORD err=GetLastError();//here it says buffer size no good, erros 1784 or 122
All I want to is get a hardware id that I can pss to CM_Locate_DevNode, as I saw on the posts here instead of trying to parse the
hardware string obtained through registernotofication, I should do it this way as its cleaner.
thank
baba Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40749
System power mode
Hi All
I would like to get notification on change at the system power mode from my NDIS intermediate driver. I can see the PnP OIDâ??s that sending to the NICâ??s but I canâ??t indicate when the computer is getting into standby or hibernate (I only know the NICâ??s power mode).
Why Iâ??m not getting IRP_MJ_POWER or IRP_MJ_PNP notification. Is NDIS hide those messages from me
Is any API on kernel to get the current computer power mode
Thanks
Ronen Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40748
Monitoring network event
Hi
the task that I'm currently approaching to, is to monitor two network 'events' on a local system (xp,win2k3): the LISTEN 'event', when a socket tries to establish a server, and the CONNECT 'event', that occurrs, when a socket tries to connect to a remote- end- point
Which approach (TDI, Winsock, NDIS Protocol, NDIS hooking, etc.) is suitable for this? Is there a good sample for the best approach
Thanks a lo
Gordo
P.S.: I'm currently NOT interested in packet filtering, so I don't need access to that Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40747
Pass Thru for Windows CE
Hi
A couple of questions. The pass thru code for CE has #ifdef UNDER_CE. Is that supposed to be turned on. Because the makefile seems to have no definition of it.
I just followed the steps as is for CE.NET for an emulator. It loads and unloads the passthru.dll immediately. Is that the
expected behavior
Any help would be appreciated. I know folks have been thru this topic tons of times. But I am not sure what kind of a behavior I am supposed to expect from passthru.dl
Som Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40746
ID of another process at Kernel level.....under win 98 environment
First of all I want to get the ID of another process.I want to do it at
kernel level.I am writing a filter driver.PsGetCurrentProcessId() is
available but its only for win2k onwards but not
for win 98.
plz suggest something.
regds
vinay Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40745
ID of another process at Kernel level.....under win 98 environment
First of all I want to get the ID of another process.I want to do it at
kernel level.I am writing a filter driver.PsGetCurrentProcessId() is
available but its only for win2k onwards but not
for win 98.
plz suggest something.
regds
vinay Tag: How to implement Selective Suspension on NDIS-WDM driver Tag: 40744
Does anybody know to implement Selective Suspension for USB device on NDIS-WDM driver? Especially how to handle IRP_MN_WAIT_WAKE on NDIS-WDM driver? Thanks.