How to include stdio functionalities in driver?

Hi guys. I’m trying to use fopen,fseek within my driver.But i get linker errors .Is there any way to use these functions?

NO

wrote in message news:xxxxx@ntdev…
> Hi guys. I’m trying to use fopen,fseek within my driver.But i get linker
> errors .Is there any way to use these functions?
>

thx david

You can’t use these. Use ZwCreateFile, ZwReadFile, ZwWriteFile, ZwClose.
There is no explicit seek because ZwReadFile and ZwWriteFile specify the
file offset (seek position) as one of the parameters.

You get link errors because you did not include the standard C library. If
you DO include the standard C library and successfully link, you will not be
able to load the driver because the kernel entry points (CreateFileA,
WriteFile, CloseHandle) are not defined; these are user-level API calls.

As far as I know, outside the DbgPrint/DbgPrintEx mechanisms, there is no
string-formatting capability in the kernel.

joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Monday, December 29, 2008 2:46 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to include stdio functionalities in driver?

Hi guys. I’m trying to use fopen,fseek within my driver.But i get linker
errors .Is there any way to use these functions?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.

> As far as I know, outside the DbgPrint/DbgPrintEx mechanisms, there is no
string-formatting capability in the kernel.

Sure there is - see RtlStringCbPrintf and friends.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Joseph M. Newcomer
Sent: Monday, December 29, 2008 4:49 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to include stdio functionalities in driver?

You can’t use these. Use ZwCreateFile, ZwReadFile, ZwWriteFile, ZwClose.
There is no explicit seek because ZwReadFile and ZwWriteFile specify the
file offset (seek position) as one of the parameters.

You get link errors because you did not include the standard C library. If
you DO include the standard C library and successfully link, you will not be
able to load the driver because the kernel entry points (CreateFileA,
WriteFile, CloseHandle) are not defined; these are user-level API calls.

As far as I know, outside the DbgPrint/DbgPrintEx mechanisms, there is no
string-formatting capability in the kernel.

joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Monday, December 29, 2008 2:46 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to include stdio functionalities in driver?

Hi guys. I’m trying to use fopen,fseek within my driver.But i get linker
errors .Is there any way to use these functions?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks.
joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Cross
Sent: Monday, December 29, 2008 5:01 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to include stdio functionalities in driver?

As far as I know, outside the DbgPrint/DbgPrintEx mechanisms, there is
no
string-formatting capability in the kernel.

Sure there is - see RtlStringCbPrintf and friends.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Joseph M. Newcomer
Sent: Monday, December 29, 2008 4:49 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to include stdio functionalities in driver?

You can’t use these. Use ZwCreateFile, ZwReadFile, ZwWriteFile, ZwClose.
There is no explicit seek because ZwReadFile and ZwWriteFile specify the
file offset (seek position) as one of the parameters.

You get link errors because you did not include the standard C library. If
you DO include the standard C library and successfully link, you will not be
able to load the driver because the kernel entry points (CreateFileA,
WriteFile, CloseHandle) are not defined; these are user-level API calls.

As far as I know, outside the DbgPrint/DbgPrintEx mechanisms, there is no
string-formatting capability in the kernel.

joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Monday, December 29, 2008 2:46 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to include stdio functionalities in driver?

Hi guys. I’m trying to use fopen,fseek within my driver.But i get linker
errors .Is there any way to use these functions?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.

> As far as I know, outside the DbgPrint/DbgPrintEx mechanisms, there is no

string-formatting capability in the kernel.

ntstrsafe.h

RtlStringCbPrintfW etc


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com