linker errors

Hi,

Why do I get linker errors when I use fopen, fprintf, fclose etc in
the kernel mode driver code? I placed such code in scanner.c (in IFS
kit) and I get the LNK2019 error (unresolved external symbol).

I then, used fopen_s and fclose_s. Still the same problem persisted.
Then, I used the #define _CRT_SECURE_NO_DEPRECATE,

It did not solve the issue. How can I get around this problem?

Thanks much,

S.Srivathsan

Satyam Computer Services Ltd,

Malleshwaram,

Bangalore - 560 012.

Desk: 23606830 Ext 1026

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

Srivathsan_Srinivasagopalan wrote:

Hi,

Why do I get linker errors when I use fopen, fprintf, fclose etc in
the kernel mode driver code? I placed such code in scanner.c (in IFS
kit) and I get the LNK2019 error (unresolved external symbol).

You can’t use these functions. This is kernel mode and only kernel mode
functions are available.

In theory you could write them, but it would be nontrivial - things like
fopen have effects… you have to deal with reentrancy, IRQ levels, etc.

I suggest going over the examples in the DDK and learning how they do
these things. Kernel mode programming is *very* different to user mode
programming.

Tony

You may not mix user mode functions with kernel mode functions.
In user mode, use whatever you know from user mode, in kernel mode,
use kernel mode functions only.

L.

You can not use those functions in the Kernel. Since your using a
minifilter, use FltCreateFile and FltReadFile.

Srivathsan_Srinivasagopalan wrote:

Hi,

Why do I get linker errors when I use fopen, fprintf, fclose etc
in the kernel mode driver code? I placed such code in scanner.c (in
IFS kit) and I get the LNK2019 error (unresolved external symbol).

I then, used fopen_s and fclose_s. Still the same problem persisted.
Then, I used the #define _CRT_SECURE_NO_DEPRECATE,

It did not solve the issue. How can I get around this problem?

Thanks much,

S.Srivathsan

Satyam Computer Services Ltd,

Malleshwaram,

Bangalore - 560 012.

Desk: 23606830 Ext 1026

DISCLAIMER:
This email (including any attachments) is intended for the sole use of
the intended recipient/s and may contain material that is CONFIDENTIAL
AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or
copying or distribution or forwarding of any or all of the contents in
this message is STRICTLY PROHIBITED. If you are not the intended
recipient, please contact the sender by email and delete all copies;
your cooperation in this regard is appreciated…

Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks. But, what is the equivalent of fprintf or fopen, fclose in kenel
mode?

Thanks,

Sri.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ladislav Zezula
Sent: Thursday, March 23, 2006 2:56 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] linker errors

You may not mix user mode functions with kernel mode functions.

In user mode, use whatever you know from user mode, in kernel mode,

use kernel mode functions only.

L.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

I am currently using DbgPrint to see what is going on (using
sysinternal’s dbgview) . But, I really need to log things into a file.
Hence, my question.

Thanks,

Sri.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ladislav Zezula
Sent: Thursday, March 23, 2006 2:56 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] linker errors

You may not mix user mode functions with kernel mode functions.

In user mode, use whatever you know from user mode, in kernel mode,

use kernel mode functions only.

L.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

Srivathsan_Srinivasagopalan wrote:

I am currently using DbgPrint to see what is going on (using
sysinternal?s dbgview) . But, I really need to log things into a file.
Hence, my question.

You can save the buffer from dbgview easily enough.

There are lots of places where it is not safe even to write to a file,
let alone open a new one (I’m not enough of an expert to know exactly
where these are so avoid it generally - keep kernel space simple, since
an error there can be catastrophic)… it’s generally not worth the
hassle just for logging.

If you really need to do this everywhere it’s probably safer to create a
communications port (FltCreateCommunictionPort) and run a service that
picks up the driver output and processes it. That way most of your
processing stays in userspace.

Tony

Thanks. I shall try to use them now.

-Sri.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of MM
Sent: Thursday, March 23, 2006 2:57 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] linker errors

You can not use those functions in the Kernel. Since your using a
minifilter, use FltCreateFile and FltReadFile.

Srivathsan_Srinivasagopalan wrote:

Hi,

Why do I get linker errors when I use fopen, fprintf, fclose etc
in the kernel mode driver code? I placed such code in scanner.c (in
IFS kit) and I get the LNK2019 error (unresolved external symbol).

I then, used fopen_s and fclose_s. Still the same problem persisted.
Then, I used the #define _CRT_SECURE_NO_DEPRECATE,

It did not solve the issue. How can I get around this problem?

Thanks much,

S.Srivathsan

Satyam Computer Services Ltd,

Malleshwaram,

Bangalore - 560 012.

Desk: 23606830 Ext 1026

DISCLAIMER:
This email (including any attachments) is intended for the sole use of

the intended recipient/s and may contain material that is CONFIDENTIAL

AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or
copying or distribution or forwarding of any or all of the contents in

this message is STRICTLY PROHIBITED. If you are not the intended
recipient, please contact the sender by email and delete all copies;
your cooperation in this regard is appreciated…

Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as:
xxxxx@satyam.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

> linker errors when I use fopen, fprintf, fclose etc in the kernel mode driver code?
A lot of replies you already got so you know the reason.

For starters you may want to check out

\Samples\Chap3\FILEIO\SYS\fileio.cpp

which gives an API for >= w2k (and w98) or

C:\WINDDK\3790.1830\src\kernel\parport\debug.c

Don’t forget that you should open not “C:\someFolder\someLogFile.dat” but “??\C:\someFolder\someLogFile.dat”.

Make sure that you do file IO on a low IRQ level (PASSIVE_LEVEL).

----- Original Message -----
From: Srivathsan_Srinivasagopalan
To: Windows File Systems Devs Interest List
Sent: Thursday, March 23, 2006 3:53 AM
Subject: [ntfsd] linker errors

Hi,

Why do I get linker errors when I use fopen, fprintf, fclose etc in the kernel mode driver code? I placed such code in scanner.c (in IFS kit) and I get the LNK2019 error (unresolved external symbol).

I then, used fopen_s and fclose_s. Still the same problem persisted. Then, I used the #define _CRT_SECURE_NO_DEPRECATE,

It did not solve the issue. How can I get around this problem?

Thanks much,

S.Srivathsan

Satyam Computer Services Ltd,

Malleshwaram,

Bangalore - 560 012.

Desk: 23606830 Ext 1026

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated…

Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Except that since this is a minifilter using the Zw calls from that example
is a BAD IDEA! Matt Martin properly pointed out use FltCreateFile and
FltReadFile.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“sh_alex” wrote in message news:xxxxx@ntfsd…
> linker errors when I use fopen, fprintf, fclose etc in the kernel mode
> driver code?
A lot of replies you already got so you know the reason.

For starters you may want to check out

\Samples\Chap3\FILEIO\SYS\fileio.cpp

which gives an API for >= w2k (and w98) or

C:\WINDDK\3790.1830\src\kernel\parport\debug.c

Don’t forget that you should open not “C:\someFolder\someLogFile.dat” but
“??\C:\someFolder\someLogFile.dat”.

Make sure that you do file IO on a low IRQ level (PASSIVE_LEVEL).

----- Original Message -----
From: Srivathsan_Srinivasagopalan
To: Windows File Systems Devs Interest List
Sent: Thursday, March 23, 2006 3:53 AM
Subject: [ntfsd] linker errors

Hi,

Why do I get linker errors when I use fopen, fprintf, fclose etc in
the kernel mode driver code? I placed such code in scanner.c (in IFS kit)
and I get the LNK2019 error (unresolved external symbol).

I then, used fopen_s and fclose_s. Still the same problem persisted. Then,
I used the #define _CRT_SECURE_NO_DEPRECATE,

It did not solve the issue. How can I get around this problem?

Thanks much,

S.Srivathsan

Satyam Computer Services Ltd,

Malleshwaram,

Bangalore - 560 012.

Desk: 23606830 Ext 1026

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated…

Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

> Except that since this is a minifilter
Missed that it was a minifilter.
Just tried to help “for starters”, OP tried to call fopen in the kernel…

----- Original Message -----
From: “Don Burn”
Newsgroups: ntfsd
To: “Windows File Systems Devs Interest List”
Sent: Thursday, March 23, 2006 10:14 AM
Subject: Re:[ntfsd] linker errors

> Except that since this is a minifilter using the Zw calls from that
> example is a BAD IDEA! Matt Martin properly pointed out use FltCreateFile
> and FltReadFile.
>
>
> –
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
>
> “sh_alex” wrote in message news:xxxxx@ntfsd…
>> linker errors when I use fopen, fprintf, fclose etc in the kernel mode
>> driver code?
> A lot of replies you already got so you know the reason.
>
> For starters you may want to check out
>
> \Samples\Chap3\FILEIO\SYS\fileio.cpp
>
> which gives an API for >= w2k (and w98) or
>
> C:\WINDDK\3790.1830\src\kernel\parport\debug.c
>
> Don’t forget that you should open not “C:\someFolder\someLogFile.dat” but
> “??\C:\someFolder\someLogFile.dat”.
>
> Make sure that you do file IO on a low IRQ level (PASSIVE_LEVEL).
>
>
>
> ----- Original Message -----
> From: Srivathsan_Srinivasagopalan
> To: Windows File Systems Devs Interest List
> Sent: Thursday, March 23, 2006 3:53 AM
> Subject: [ntfsd] linker errors
>
>
> Hi,
>
> Why do I get linker errors when I use fopen, fprintf, fclose etc in
> the kernel mode driver code? I placed such code in scanner.c (in IFS kit)
> and I get the LNK2019 error (unresolved external symbol).
>
>
>
> I then, used fopen_s and fclose_s. Still the same problem persisted.
> Then, I used the #define _CRT_SECURE_NO_DEPRECATE,
>
> It did not solve the issue. How can I get around this problem?
>
>
>
> Thanks much,
>
> S.Srivathsan
>
> Satyam Computer Services Ltd,
>
> Malleshwaram,
>
> Bangalore - 560 012.
>
>
>
> Desk: 23606830 Ext 1026
>
>
>
>
> DISCLAIMER:
> This email (including any attachments) is intended for the sole use of
> the intended recipient/s and may contain material that is CONFIDENTIAL AND
> PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying
> or distribution or forwarding of any or all of the contents in this
> message is STRICTLY PROHIBITED. If you are not the intended recipient,
> please contact the sender by email and delete all copies; your cooperation
> in this regard is appreciated…
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
> ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@comcast.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

> Why do I get linker errors when I use fopen, fprintf, fclose etc in

the kernel mode driver code? I placed such code in scanner.c (in IFS

There is no these functions in the kernel, and no ways to use them. Use
ZwCreateFile and StringCchPrintf+ZwWriteFile.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Use WPP for this.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Srivathsan_Srinivasagopalan”
To: “Windows File Systems Devs Interest List”
Sent: Thursday, March 23, 2006 1:37 PM
Subject: RE: [ntfsd] linker errors

I am currently using DbgPrint to see what is going on (using
sysinternal’s dbgview) . But, I really need to log things into a file.
Hence, my question.

Thanks,

Sri.

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ladislav Zezula
Sent: Thursday, March 23, 2006 2:56 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] linker errors

You may not mix user mode functions with kernel mode functions.

In user mode, use whatever you know from user mode, in kernel mode,

use kernel mode functions only.

L.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE
COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact the
sender by email and delete all copies; your cooperation in this regard is
appreciated.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com