btowc

Hi,

I’m trying to use the function ‘btowc’, in my driver.

I modified my sources file, added msvcprt_btowc.lib:

TARGETLIBS=$(TARGETLIBS) \
$(DDK_LIB_PATH)\ntstrsafe.lib \
$(BASEDIR)\lib\crt\i386\msvcprt_btowc.lib

Everything compiles, but my driver shows up with a yellow bang. Is it because I am linking dynamically, and if so, how do I link statically.

Thanks.

NEVER try to use a user-mode library (like CRT) in a driver!!!

Search the WDK help. Functions like RtlAnsiStringToUnicodeString might help.

Sounds simple? Make absolutely certain that you fully understand the
requirements associated with the use of string functions in the kernel:

Requirements
IRQL: PASSIVE_LEVEL

Good luck,

Thomas F. Divine

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Wednesday, August 26, 2009 4:05 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] btowc

Hi,

I’m trying to use the function ‘btowc’, in my driver.

I modified my sources file, added msvcprt_btowc.lib:

TARGETLIBS=$(TARGETLIBS) \
$(DDK_LIB_PATH)\ntstrsafe.lib \
$(BASEDIR)\lib\crt\i386\msvcprt_btowc.lib

Everything compiles, but my driver shows up with a yellow bang. Is it
because I am linking dynamically, and if so, how do I link statically.

Thanks.


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

You don’t.

Probably not the answer you wanted. You are trying to translate from
single-byte to wide char? In a driver? Why?

The c runtime support for string manipulation is rather limited in the
kernel and you cannot just go and try to link in random libraries,
static or otherwise.

Mark Roddy

On Wed, Aug 26, 2009 at 4:04 PM, wrote:
> btowc

What binaries does link /dump /imports (your sys file) list? My guess is that you are importing from a user mode dll

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@gmail.com
Sent: Wednesday, August 26, 2009 1:06 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] btowc

Hi,

I’m trying to use the function ‘btowc’, in my driver.

I modified my sources file, added msvcprt_btowc.lib:

TARGETLIBS=$(TARGETLIBS) <br> $(DDK_LIB_PATH)\ntstrsafe.lib <br> $(BASEDIR)\lib\crt\i386\msvcprt_btowc.lib

Everything compiles, but my driver shows up with a yellow bang. Is it because I am linking dynamically, and if so, how do I link statically.

Thanks.


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, just what I was looking for.

xxxxx@gmail.com wrote:

I’m trying to use the function ‘btowc’, in my driver.

I modified my sources file, added msvcprt_btowc.lib:

TARGETLIBS=$(TARGETLIBS) \
$(DDK_LIB_PATH)\ntstrsafe.lib \
$(BASEDIR)\lib\crt\i386\msvcprt_btowc.lib

Everything compiles, but my driver shows up with a yellow bang. Is it because I am linking dynamically, and if so, how do I link statically.

Most of the C run-time library is available for kernel drivers in
$(DDK_LIB_PATH)\libcntpr.lib. It contains the ANSI standard routine
“mbtowc”, which does essentially the same thing as “btowc”.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.