Binary/Hex to ASCII conversion in driver

I think you are using C++ for the wrong reasons then.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Moreira, Alberto
Sent: Wednesday, April 16, 2003 1:50 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

A couple of things, yet first beware, I’m a minimalist. Before I did
video
drivers for a living, I was a Bios programmer, so, you know where I’m
coming
from ! I only use something if I’m forced to, and even then, I’ll only
use
it screaming and kicking. My personal take on this is, and I don’t ask
anyone to follow me, Operating Systems and Runtime Libraries are there
to be
bypassed: the best OS is the one I can take for granted and that doesn’t
stand on my way when I need to do something funky.

But on to specifics,

(1) This is Alberto speaking, not Compuware.
(2) I should have been more specific: I don’t like to use C libraries in
kernel code either.
(5) I have been using iostreams and cin/cout like stuff long enough that
I
no longer care for printf and its relatives. And guess what, apart from
a
few specific formats, I ignore the bulk of that functionality: I don’t
need
it, and it’s been many moons since I last included stdio.h in my code.

And also, no, using sprintf doesn’t save time, not to me anyway: I wrote
the
binary-to-ascii routine I emailed to you guys in less than a minute, and
it
worked first time. Hence, why bother with sprintf ? It’s clunkier, it
adds
lots of unused baggage, and it takes me longer to debug because it’s not
my
code nor my semantics. Also, I can’t help to a feeling of writing dirty
code
if I invoke a C library routine from inside one of my C++ classes. But
then,
hey, that’s a personal thing.

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 4:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Mm let me think…

(1) It’s my code, and I trust my hand better than anyone else’s

Coming from the mouth of someone who pushes a certain driver framework
library, that statement seems contradictory.

(2) I don’t
use anything in my service routines that’s not strictly ANSI C, so, I
don’t
depend on someone else’s headers,

sprintf() is ANSI C. Isn’t it?
http://www.lysator.liu.se/c/rat/d9.html#4-9-6-5

(5) I can write it an test it in way less
time it would take me to learn how sprintf works or what’s the
semantics of
the Microsoft types.

I thought everyone who learned C/C++ was familiar with the printf()
function. Maybe I shouldn’t make that assumption? In any case,
learning
sprintf() is definitely worth the effort: it will save you time every
single
occasion where you need to format data into a string! You won’t even
need
to write a special function. sprintf() must be the standard function I
use
the most.

Mat

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Wednesday, April 16, 2003 3:55 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Well…

(1) It’s my code, and I trust my hand better than anyone else’s, (2) I
don’t
use anything in my service routines that’s not strictly ANSI C, so, I
don’t
depend on someone else’s headers, (3) I can tailor it exactly to what I
need, (4) I can give my file a .cpp extension and take advantage of C++
features not available in C, and (5) I can write it an test it in way
less
time it would take me to learn how sprintf works or what’s the semantics
of
the Microsoft types.

It may be my own professional bias, but I like to minimize the number of
strings attached to my code !

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 2:29 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

What’s the point in writing that kind of code when you could simply
#include
<stdio.h> and call sprintf()?

OF COURSE, that will run faster if you define a function which will do
just
the minimum you need. But is it really worth the time and risk of bug?

Unless that function is in a tight loop, I would rather use sprintf()…
Any objections?

Mat

-----Original Message-----
From: Christiaan Ghijselinck
[mailto:xxxxx@CompaqNet.be]
Sent: Wednesday, April 16, 2003 2:12 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Ho, here we go …

I hope that the ( two ) question poster guy(s) didn’t commit suicide
after
all previous comments … :)))

Christiaan

/----------------------------------------------------------------------
----
-------------------
/

UCHAR aValToCharConverter[16] = {
‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘A’,‘B’,‘C’,‘D’,‘E’,‘F’ } ;

VOID ConvertSequence ( IN ULONG nBinarySequenceSize ,
IN PVOID
pBinarySequence ,

# pragma pack ( 1 )
typedef UCHAR UCHARARRAY ;
typedef UCHARARRAY pUCHARARRAY ;
# pragma pack ( )

CCHAR _cSequenceBuffer[128]; // OUTPUT

UCHAR _bytevalue ;
UCHAR _lnibble ;
UCHAR _hnibble ;

ULONG _binindex ;

/
convert the binary strings into character strings /

for ( _binindex = 0 ; _binindex < nBinarySequenceSize ; _binindex++ )
{
/
next code seems to generate the smallest amount of ASM
instructions
/
_bytevalue = (
(pUCHARARRAY)pBinarySequence)[_binindex] ;

_lnibble = aValToCharConverter[_bytevalue & 0x0F] ;
_hnibble = aValToCharConverter[_bytevalue >> 4] ;

_cSequenceBuffer[(_binindex << 1)] = _hnibble ;
_cSequenceBuffer[(_binindex << 1) + 1] = _lnibble ;
}

_cSequenceBuffer[nBinarySequenceSize << 1] = 0 ; /* string closing
zero
*/



}

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Wednesday, April 16, 2003 6:40 PM
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

> Here, a very simple function - three lines of code - and a naive C++
tester
> to go with it. The “issue” call puts the characters out, one by one.
You
> guys can convert it to assembler if you will, but I don’t think it’s
> necessary.
>
> Hope this helps !
>
> Alberto.
>
> //==============================================================
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> }
> //==============================================================
>
> //==============================================================
> #include
> using namespace std;
>
> #define BUFFERSIZE 16
>
> static char c[BUFFERSIZE];
> static int p=0;
>
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> }
>
> void prime()
> {
> p = 0;
> for (int i=0; i> }
>
> void issue(int digit)
> {
> c[p++] = digit;
> c[p] = 0;
> }
>
>
> main()
> {
> prime(); convert(0); cout << c << endl;
> prime(); convert(0x1); cout << c << endl;
> prime(); convert(0x12); cout << c << endl;
> prime(); convert(0x123); cout << c << endl;
>
> return 0;
> }
> //==============================================================
>
> ----Original Message-----
> From: Daniel E. Germann [mailto:xxxxx@nospam.visi.com]
> Sent: Wednesday, April 16, 2003 9:10 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> Ahem. Allow me to kick myself in the pants. Please accept this
correction:
> add al,90h
> daa
> adc al,40h
> daa
>
> -Dan
>
> ----- Original Message -----
> From: “Daniel E. Germann”
> To: “NT Developers Interest List”
> Sent: Wednesday, April 16, 2003 8:06 AM
> Subject: Re: Binary/Hex to ASCII conversion in driver
>
>
> > OK, don’t flame me. My favorite binary-to-ASCII conversion on the
x86
> > platform is to put the 4-bit binary value I want to convert to ASCII
in
> the
> > AX register and then do:
> >
> > add al,40h
> > daa
> > adc al,90h
> > daa
> >
> > The result is an ASCII hex digit in the AX register. It’s not
portable,
> but
> > it is a nifty piece of code.
> >
> > I think credit for this goes to Tim Paterson at Seattle Computer
Products
> > (circa 1980). At least that’s the first reference I saw to this
> particular
> > method.
> >
> > -Dan
> >
> > ----- Original Message -----
> > > Subject: Binary/Hex to ASCII conversion in driver
> > > From: Tom Pr
> > > Date: Tue, 15 Apr 2003 16:36:02 -0700 (PDT)
> > >
> > > Hi All,
> > >
> > > How should I convert my 8 bit binary/Hex value to
> > > corresponding ASCII in my device driver.
>
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only.
It
> contains information that may be confidential. Unless you are the
named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


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


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

The contents of this e-mail are intended for the named addressee only.
It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or
disclose
it to anyone else. If you received it in error please notify us
immediately
and then destroy it.


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


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

The contents of this e-mail are intended for the named addressee only.
It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or
disclose
it to anyone else. If you received it in error please notify us
immediately
and then destroy it.


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</stdio.h>

I guess if you have the luxury of only using XP and Server 2003, these
are OK, but if downward compatibility is an issue, they are useless.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
Sent: Wednesday, April 16, 2003 3:55 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

But better to use the functions found in NTSTRSAFE.H and NTSTRSAFE.LIB.

char SzGuidToPrint[GUID_SIZE];
NTSTATUS status;

status = RtlStringCchPrintfW(SzGuidToPrint, sizeof(SzGuidToPrint),
L"%08lx",
Guid.Data1);

Read next months article in Windows Driver Developers Digest.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Jamey Kirby” wrote in message
news:xxxxx@ntdev…
>
> Enough sarcasm; I guess…
>
> I think he may be looking for ACII character representation of a
number
> like 100 -> “100” for a printable string or something.
>
> You can do it the hard way or you can use various sprintf like
functions
> to do the formatting for you.
>
> In some of our drivers, we have code like this:
>
> swprintf(SzGuidToPrint, L"%08lx", Guid.Data1);
>
> where SzGuidToPrint is a string representation of the value.
>
> Jamey
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Jamey Kirby
> Sent: Tuesday, April 15, 2003 5:21 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
> Does it matter :slight_smile:
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Justin Frodsham
> Sent: Tuesday, April 15, 2003 5:00 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
> I am not certain you have supplied enough information answer the
> question. What are you trying to do? ASCII can be represented by an
> 8bit
> binary/hex value… So I don’t understand what you are trying to
> convert
> from/to.
>
> -Justin
>
> At 01:36 PM 4/15/2003, you wrote:
> >Hi All,
> >
> >How should I convert my 8 bit binary/Hex value to
> >corresponding ASCII in my device driver.
> >
> >
> > __________________________________________________
> >Do you Yahoo!?
> >The New Yahoo! Search - Faster. Easier. Bingo
> >http://search.yahoo.com
> >
> >
> >—
> >You are currently subscribed to ntdev as: zeppelin@io.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>


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

Use the source Luke.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David J. Craig
Sent: Wednesday, April 16, 2003 4:12 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

I looked in the WNET DDK help file and the header file and couldn’t find
any
reference to IRQL. I think they need to tell us about any restrictions
even
if there are none.

----- Original Message -----
From: “Michal Vodicka”
To: “NT Developers Interest List”
Sent: Wednesday, April 16, 2003 5:32 PM
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

> Mike,
>
> it seems well at first look. What I’m missing is the info about safe
IRQ
> levels where these functions can be used. I presume some are safe at
> DISPATCH_LEVEL as far as nonpaged memory is used for buffers and some
may
> not be as sprintf replacements using unicode formats. However, this
info
is
> essential for kernel mode developers and should be provided.
>
> Best regards,
>
> Michal Vodicka
> STMicroelectronics Design and Application s.r.o.
> [michal.vodicka@st.com, http:://www.st.com]
>
> > ----------
> > From: xxxxx@microsoft.com[SMTP:xxxxx@microsoft.com]
> > Reply To: xxxxx@lists.osr.com
> > Sent: Wednesday, April 16, 2003 10:47 PM
> > To: xxxxx@lists.osr.com
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > For anyone considering string manipulation of this sort may I
strongly
> > encourage you to check out strsafe.h that lives in the DDK under
> > inc\crt.
> >
> > You’ll find alternatives to the standard CRT string manipulation
> > functions that help avoid some of the common pitfalls we see with
string
> > manipulation (buffer overruns etc.), all of which were developed as
part
> > of the Windows security initiative last year.
> >
> > Please let us know if you have feedback - positive or negative!
> >
> > = Mike =
> >
> > This posting is provided “AS IS” with no warranties, and confers no
> > rights
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


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

Well sir, given that _vsnprintf is available in your target platform … copy
the bloody files into your working directory, set the frigging compile
switch and COMPILE. :slight_smile: They give us the SOURCE code for the functions.


Gary G. Little
Have Computer, will travel …
(909) 6983191
(909) 5512105
http://www.wd-3.com

“Jamey Kirby” wrote in message news:xxxxx@ntdev…
>
> I guess if you have the luxury of only using XP and Server 2003, these
> are OK, but if downward compatibility is an issue, they are useless.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
> Sent: Wednesday, April 16, 2003 3:55 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
> But better to use the functions found in NTSTRSAFE.H and NTSTRSAFE.LIB.
>
> char SzGuidToPrint[GUID_SIZE];
> NTSTATUS status;
>
> status = RtlStringCchPrintfW(SzGuidToPrint, sizeof(SzGuidToPrint),
> L"%08lx",
> Guid.Data1);
>
> Read next months article in Windows Driver Developers Digest.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> “Jamey Kirby” wrote in message
> news:xxxxx@ntdev…
> >
> > Enough sarcasm; I guess…
> >
> > I think he may be looking for ACII character representation of a
> number
> > like 100 -> “100” for a printable string or something.
> >
> > You can do it the hard way or you can use various sprintf like
> functions
> > to do the formatting for you.
> >
> > In some of our drivers, we have code like this:
> >
> > swprintf(SzGuidToPrint, L"%08lx", Guid.Data1);
> >
> > where SzGuidToPrint is a string representation of the value.
> >
> > Jamey
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jamey Kirby
> > Sent: Tuesday, April 15, 2003 5:21 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > Does it matter :slight_smile:
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Justin Frodsham
> > Sent: Tuesday, April 15, 2003 5:00 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > I am not certain you have supplied enough information answer the
> > question. What are you trying to do? ASCII can be represented by an
> > 8bit
> > binary/hex value… So I don’t understand what you are trying to
> > convert
> > from/to.
> >
> > -Justin
> >
> > At 01:36 PM 4/15/2003, you wrote:
> > >Hi All,
> > >
> > >How should I convert my 8 bit binary/Hex value to
> > >corresponding ASCII in my device driver.
> > >
> > >
> > > __________________________________________________
> > >Do you Yahoo!?
> > >The New Yahoo! Search - Faster. Easier. Bingo
> > >http://search.yahoo.com
> > >
> > >
> > >—
> > >You are currently subscribed to ntdev as: zeppelin@io.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>

yeah Cristiaan,

The comments from top guns could be very heavy to handle for a newbie :)Some
times the guns become so vaugh.

–Subodh
----- Original Message -----
From: “Christiaan Ghijselinck”
To: “NT Developers Interest List”
Sent: Wednesday, April 16, 2003 11:42 PM
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

>
> Ho, here we go …
>
> I hope that the ( two ) question poster guy(s) didn’t commit suicide after
all previous comments … :)))
>
> Christiaan
>
>
/--------------------------------------------------------------------------
-------------------
/
>
>
> UCHAR aValToCharConverter[16] = {
‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘A’,‘B’,‘C’,‘D’,‘E’,‘F’ } ;
>
> VOID ConvertSequence ( IN ULONG nBinarySequenceSize ,
> IN PVOID
pBinarySequence ,
>
>
> # pragma pack ( 1 )
> typedef UCHAR UCHARARRAY ;
> typedef UCHARARRAY pUCHARARRAY ;
> # pragma pack ( )
>
> CCHAR _cSequenceBuffer[128]; // OUTPUT
>
> UCHAR _bytevalue ;
> UCHAR _lnibble ;
> UCHAR _hnibble ;
>
> ULONG _binindex ;
>
>
> /
convert the binary strings into character strings /
>
> for ( _binindex = 0 ; _binindex < nBinarySequenceSize ; _binindex++ )
> {
> /
next code seems to generate the smallest amount of ASM
instructions /
> _bytevalue = (
(pUCHARARRAY)pBinarySequence)[_binindex] ;
>
> _lnibble = aValToCharConverter[_bytevalue & 0x0F] ;
> _hnibble = aValToCharConverter[_bytevalue >> 4] ;
>
> _cSequenceBuffer[(_binindex << 1)] = _hnibble ;
> _cSequenceBuffer[(_binindex << 1) + 1] = _lnibble ;
> }
>
> _cSequenceBuffer[nBinarySequenceSize << 1] = 0 ; /* string closing zero
*/
>
>
> …
>
>
> }
>
>
>
>
>
>
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “NT Developers Interest List”
> Sent: Wednesday, April 16, 2003 6:40 PM
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> > Here, a very simple function - three lines of code - and a naive C++
tester
> > to go with it. The “issue” call puts the characters out, one by one. You
> > guys can convert it to assembler if you will, but I don’t think it’s
> > necessary.
> >
> > Hope this helps !
> >
> > Alberto.
> >
> > //==============================================================
> > void convert(int n)
> > {
> > char *k = “0123456789ABCDEF”;
> > if (n > 15) convert(n>>4);
> > issue (k[n&0xf]);
> > }
> > //==============================================================
> >
> > //==============================================================
> > #include
> > using namespace std;
> >
> > #define BUFFERSIZE 16
> >
> > static char c[BUFFERSIZE];
> > static int p=0;
> >
> > void convert(int n)
> > {
> > char *k = “0123456789ABCDEF”;
> > if (n > 15) convert(n>>4);
> > issue (k[n&0xf]);
> > }
> >
> > void prime()
> > {
> > p = 0;
> > for (int i=0; i> > }
> >
> > void issue(int digit)
> > {
> > c[p++] = digit;
> > c[p] = 0;
> > }
> >
> >
> > main()
> > {
> > prime(); convert(0); cout << c << endl;
> > prime(); convert(0x1); cout << c << endl;
> > prime(); convert(0x12); cout << c << endl;
> > prime(); convert(0x123); cout << c << endl;
> >
> > return 0;
> > }
> > //==============================================================
> >
> > ----Original Message-----
> > From: Daniel E. Germann [mailto:xxxxx@nospam.visi.com]
> > Sent: Wednesday, April 16, 2003 9:10 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> >
> > Ahem. Allow me to kick myself in the pants. Please accept this
correction:
> > add al,90h
> > daa
> > adc al,40h
> > daa
> >
> > -Dan
> >
> > ----- Original Message -----
> > From: “Daniel E. Germann”
> > To: “NT Developers Interest List”
> > Sent: Wednesday, April 16, 2003 8:06 AM
> > Subject: Re: Binary/Hex to ASCII conversion in driver
> >
> >
> > > OK, don’t flame me. My favorite binary-to-ASCII conversion on the x86
> > > platform is to put the 4-bit binary value I want to convert to ASCII
in
> > the
> > > AX register and then do:
> > >
> > > add al,40h
> > > daa
> > > adc al,90h
> > > daa
> > >
> > > The result is an ASCII hex digit in the AX register. It’s not
portable,
> > but
> > > it is a nifty piece of code.
> > >
> > > I think credit for this goes to Tim Paterson at Seattle Computer
Products
> > > (circa 1980). At least that’s the first reference I saw to this
> > particular
> > > method.
> > >
> > > -Dan
> > >
> > > ----- Original Message -----
> > > > Subject: Binary/Hex to ASCII conversion in driver
> > > > From: Tom Pr
> > > > Date: Tue, 15 Apr 2003 16:36:02 -0700 (PDT)
> > > >
> > > > Hi All,
> > > >
> > > > How should I convert my 8 bit binary/Hex value to
> > > > corresponding ASCII in my device driver.
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
disclose
> > it to anyone else. If you received it in error please notify us
immediately
> > and then destroy it.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
xxxxx@compaqnet.be
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@softhome.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com

LOL…

At 12:59 PM 4/16/2003, you wrote:

Justin … don’t be silly … FORTH is always the language of choice.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Justin Frodsham” wrote in message news:xxxxx@ntdev…
> >
> > Very funny… first though… if you want to write a really good
> > driver you need to use LOGO as your programming language. VB is way too
> > low level.
> >
> > -J
> >
> > At 03:34 PM 4/15/2003, you wrote:
> > >I want to write an encrypting file system driver. I have written
> > >several hello world programs in VB before. What do I need to know to do
> > >this?
> > >
> > >Thanks,
> > >Rob

Howso ? It’s easier to write C++ code than it is to write C code. The
availability of inheritance and polymorphism makes writing complex code a
lot easier.

Alberto.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, April 16, 2003 9:31 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

I think you are using C++ for the wrong reasons then.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Moreira, Alberto
Sent: Wednesday, April 16, 2003 1:50 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

A couple of things, yet first beware, I’m a minimalist. Before I did
video
drivers for a living, I was a Bios programmer, so, you know where I’m
coming
from ! I only use something if I’m forced to, and even then, I’ll only
use
it screaming and kicking. My personal take on this is, and I don’t ask
anyone to follow me, Operating Systems and Runtime Libraries are there
to be
bypassed: the best OS is the one I can take for granted and that doesn’t
stand on my way when I need to do something funky.

But on to specifics,

(1) This is Alberto speaking, not Compuware.
(2) I should have been more specific: I don’t like to use C libraries in
kernel code either.
(5) I have been using iostreams and cin/cout like stuff long enough that
I
no longer care for printf and its relatives. And guess what, apart from
a
few specific formats, I ignore the bulk of that functionality: I don’t
need
it, and it’s been many moons since I last included stdio.h in my code.

And also, no, using sprintf doesn’t save time, not to me anyway: I wrote
the
binary-to-ascii routine I emailed to you guys in less than a minute, and
it
worked first time. Hence, why bother with sprintf ? It’s clunkier, it
adds
lots of unused baggage, and it takes me longer to debug because it’s not
my
code nor my semantics. Also, I can’t help to a feeling of writing dirty
code
if I invoke a C library routine from inside one of my C++ classes. But
then,
hey, that’s a personal thing.

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 4:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Mm let me think…

(1) It’s my code, and I trust my hand better than anyone else’s

Coming from the mouth of someone who pushes a certain driver framework
library, that statement seems contradictory.

(2) I don’t
use anything in my service routines that’s not strictly ANSI C, so, I
don’t
depend on someone else’s headers,

sprintf() is ANSI C. Isn’t it?
http://www.lysator.liu.se/c/rat/d9.html#4-9-6-5

(5) I can write it an test it in way less
time it would take me to learn how sprintf works or what’s the
semantics of
the Microsoft types.

I thought everyone who learned C/C++ was familiar with the printf()
function. Maybe I shouldn’t make that assumption? In any case,
learning
sprintf() is definitely worth the effort: it will save you time every
single
occasion where you need to format data into a string! You won’t even
need
to write a special function. sprintf() must be the standard function I
use
the most.

Mat

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Wednesday, April 16, 2003 3:55 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Well…

(1) It’s my code, and I trust my hand better than anyone else’s, (2) I
don’t
use anything in my service routines that’s not strictly ANSI C, so, I
don’t
depend on someone else’s headers, (3) I can tailor it exactly to what I
need, (4) I can give my file a .cpp extension and take advantage of C++
features not available in C, and (5) I can write it an test it in way
less
time it would take me to learn how sprintf works or what’s the semantics
of
the Microsoft types.

It may be my own professional bias, but I like to minimize the number of
strings attached to my code !

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 2:29 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

What’s the point in writing that kind of code when you could simply
#include
<stdio.h> and call sprintf()?

OF COURSE, that will run faster if you define a function which will do
just
the minimum you need. But is it really worth the time and risk of bug?

Unless that function is in a tight loop, I would rather use sprintf()…
Any objections?

Mat

-----Original Message-----
From: Christiaan Ghijselinck
[mailto:xxxxx@CompaqNet.be]
Sent: Wednesday, April 16, 2003 2:12 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Ho, here we go …

I hope that the ( two ) question poster guy(s) didn’t commit suicide
after
all previous comments … :)))

Christiaan

/----------------------------------------------------------------------
----
-------------------
/

UCHAR aValToCharConverter[16] = {
‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘A’,‘B’,‘C’,‘D’,‘E’,‘F’ } ;

VOID ConvertSequence ( IN ULONG nBinarySequenceSize ,
IN PVOID
pBinarySequence ,

# pragma pack ( 1 )
typedef UCHAR UCHARARRAY ;
typedef UCHARARRAY pUCHARARRAY ;
# pragma pack ( )

CCHAR _cSequenceBuffer[128]; // OUTPUT

UCHAR _bytevalue ;
UCHAR _lnibble ;
UCHAR _hnibble ;

ULONG _binindex ;

/
convert the binary strings into character strings /

for ( _binindex = 0 ; _binindex < nBinarySequenceSize ; _binindex++ )
{
/
next code seems to generate the smallest amount of ASM
instructions
/
_bytevalue = (
(pUCHARARRAY)pBinarySequence)[_binindex] ;

_lnibble = aValToCharConverter[_bytevalue & 0x0F] ;
_hnibble = aValToCharConverter[_bytevalue >> 4] ;

_cSequenceBuffer[(_binindex << 1)] = _hnibble ;
_cSequenceBuffer[(_binindex << 1) + 1] = _lnibble ;
}

_cSequenceBuffer[nBinarySequenceSize << 1] = 0 ; /* string closing
zero
*/



}

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Wednesday, April 16, 2003 6:40 PM
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

> Here, a very simple function - three lines of code - and a naive C++
tester
> to go with it. The “issue” call puts the characters out, one by one.
You
> guys can convert it to assembler if you will, but I don’t think it’s
> necessary.
>
> Hope this helps !
>
> Alberto.
>
> //==============================================================
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> }
> //==============================================================
>
> //==============================================================
> #include
> using namespace std;
>
> #define BUFFERSIZE 16
>
> static char c[BUFFERSIZE];
> static int p=0;
>
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> }
>
> void prime()
> {
> p = 0;
> for (int i=0; i> }
>
> void issue(int digit)
> {
> c[p++] = digit;
> c[p] = 0;
> }
>
>
> main()
> {
> prime(); convert(0); cout << c << endl;
> prime(); convert(0x1); cout << c << endl;
> prime(); convert(0x12); cout << c << endl;
> prime(); convert(0x123); cout << c << endl;
>
> return 0;
> }
> //==============================================================
>
> ----Original Message-----
> From: Daniel E. Germann [mailto:xxxxx@nospam.visi.com]
> Sent: Wednesday, April 16, 2003 9:10 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> Ahem. Allow me to kick myself in the pants. Please accept this
correction:
> add al,90h
> daa
> adc al,40h
> daa
>
> -Dan
>
> ----- Original Message -----
> From: “Daniel E. Germann”
> To: “NT Developers Interest List”
> Sent: Wednesday, April 16, 2003 8:06 AM
> Subject: Re: Binary/Hex to ASCII conversion in driver
>
>
> > OK, don’t flame me. My favorite binary-to-ASCII conversion on the
x86
> > platform is to put the 4-bit binary value I want to convert to ASCII
in
> the
> > AX register and then do:
> >
> > add al,40h
> > daa
> > adc al,90h
> > daa
> >
> > The result is an ASCII hex digit in the AX register. It’s not
portable,
> but
> > it is a nifty piece of code.
> >
> > I think credit for this goes to Tim Paterson at Seattle Computer
Products
> > (circa 1980). At least that’s the first reference I saw to this
> particular
> > method.
> >
> > -Dan
> >
> > ----- Original Message -----
> > > Subject: Binary/Hex to ASCII conversion in driver
> > > From: Tom Pr
> > > Date: Tue, 15 Apr 2003 16:36:02 -0700 (PDT)
> > >
> > > Hi All,
> > >
> > > How should I convert my 8 bit binary/Hex value to
> > > corresponding ASCII in my device driver.
>
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only.
It
> contains information that may be confidential. Unless you are the
named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


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


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

The contents of this e-mail are intended for the named addressee only.
It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or
disclose
it to anyone else. If you received it in error please notify us
immediately
and then destroy it.


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


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

The contents of this e-mail are intended for the named addressee only.
It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or
disclose
it to anyone else. If you received it in error please notify us
immediately
and then destroy it.


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


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.</stdio.h>

By the time I went through all those gyrations, I might as well have written
my own code.

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Thursday, April 17, 2003 12:49 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Well sir, given that _vsnprintf is available in your target platform … copy
the bloody files into your working directory, set the frigging compile
switch and COMPILE. :slight_smile: They give us the SOURCE code for the functions.


Gary G. Little
Have Computer, will travel …
(909) 6983191
(909) 5512105
http://www.wd-3.com

“Jamey Kirby” wrote in message news:xxxxx@ntdev…
>
> I guess if you have the luxury of only using XP and Server 2003, these
> are OK, but if downward compatibility is an issue, they are useless.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
> Sent: Wednesday, April 16, 2003 3:55 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
> But better to use the functions found in NTSTRSAFE.H and NTSTRSAFE.LIB.
>
> char SzGuidToPrint[GUID_SIZE];
> NTSTATUS status;
>
> status = RtlStringCchPrintfW(SzGuidToPrint, sizeof(SzGuidToPrint),
> L"%08lx",
> Guid.Data1);
>
> Read next months article in Windows Driver Developers Digest.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> “Jamey Kirby” wrote in message
> news:xxxxx@ntdev…
> >
> > Enough sarcasm; I guess…
> >
> > I think he may be looking for ACII character representation of a
> number
> > like 100 -> “100” for a printable string or something.
> >
> > You can do it the hard way or you can use various sprintf like
> functions
> > to do the formatting for you.
> >
> > In some of our drivers, we have code like this:
> >
> > swprintf(SzGuidToPrint, L"%08lx", Guid.Data1);
> >
> > where SzGuidToPrint is a string representation of the value.
> >
> > Jamey
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jamey Kirby
> > Sent: Tuesday, April 15, 2003 5:21 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > Does it matter :slight_smile:
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Justin Frodsham
> > Sent: Tuesday, April 15, 2003 5:00 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > I am not certain you have supplied enough information answer the
> > question. What are you trying to do? ASCII can be represented by an
> > 8bit
> > binary/hex value… So I don’t understand what you are trying to
> > convert
> > from/to.
> >
> > -Justin
> >
> > At 01:36 PM 4/15/2003, you wrote:
> > >Hi All,
> > >
> > >How should I convert my 8 bit binary/Hex value to
> > >corresponding ASCII in my device driver.
> > >
> > >
> > > __________________________________________________
> > >Do you Yahoo!?
> > >The New Yahoo! Search - Faster. Easier. Bingo
> > >http://search.yahoo.com
> > >
> > >
> > >—
> > >You are currently subscribed to ntdev as: zeppelin@io.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

I was just wondering how this thread could get any more irritating. A shift
to C vs C++ should do the trick.

Tom

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Thursday, April 17, 2003 9:22 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Howso ? It’s easier to write C++ code than it is to write C code. The
availability of inheritance and polymorphism makes writing complex code a
lot easier.

Alberto.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, April 16, 2003 9:31 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

I think you are using C++ for the wrong reasons then.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Moreira, Alberto
Sent: Wednesday, April 16, 2003 1:50 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

A couple of things, yet first beware, I’m a minimalist. Before I did video
drivers for a living, I was a Bios programmer, so, you know where I’m coming
from ! I only use something if I’m forced to, and even then, I’ll only use
it screaming and kicking. My personal take on this is, and I don’t ask
anyone to follow me, Operating Systems and Runtime Libraries are there to be
bypassed: the best OS is the one I can take for granted and that doesn’t
stand on my way when I need to do something funky.

But on to specifics,

(1) This is Alberto speaking, not Compuware.
(2) I should have been more specific: I don’t like to use C libraries in
kernel code either.
(5) I have been using iostreams and cin/cout like stuff long enough that I
no longer care for printf and its relatives. And guess what, apart from a
few specific formats, I ignore the bulk of that functionality: I don’t need
it, and it’s been many moons since I last included stdio.h in my code.

And also, no, using sprintf doesn’t save time, not to me anyway: I wrote the
binary-to-ascii routine I emailed to you guys in less than a minute, and it
worked first time. Hence, why bother with sprintf ? It’s clunkier, it adds
lots of unused baggage, and it takes me longer to debug because it’s not my
code nor my semantics. Also, I can’t help to a feeling of writing dirty code
if I invoke a C library routine from inside one of my C++ classes. But then,
hey, that’s a personal thing.

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 4:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Mm let me think…

(1) It’s my code, and I trust my hand better than anyone else’s

Coming from the mouth of someone who pushes a certain driver framework
library, that statement seems contradictory.

(2) I don’t
use anything in my service routines that’s not strictly ANSI C, so, I
don’t
depend on someone else’s headers,

sprintf() is ANSI C. Isn’t it?
http://www.lysator.liu.se/c/rat/d9.html#4-9-6-5

(5) I can write it an test it in way less
time it would take me to learn how sprintf works or what’s the
semantics of
the Microsoft types.

I thought everyone who learned C/C++ was familiar with the printf()
function. Maybe I shouldn’t make that assumption? In any case, learning
sprintf() is definitely worth the effort: it will save you time every single
occasion where you need to format data into a string! You won’t even need
to write a special function. sprintf() must be the standard function I use
the most.

Mat

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Wednesday, April 16, 2003 3:55 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Well…

(1) It’s my code, and I trust my hand better than anyone else’s, (2) I don’t
use anything in my service routines that’s not strictly ANSI C, so, I don’t
depend on someone else’s headers, (3) I can tailor it exactly to what I
need, (4) I can give my file a .cpp extension and take advantage of C++
features not available in C, and (5) I can write it an test it in way less
time it would take me to learn how sprintf works or what’s the semantics of
the Microsoft types.

It may be my own professional bias, but I like to minimize the number of
strings attached to my code !

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 2:29 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

What’s the point in writing that kind of code when you could simply #include
<stdio.h> and call sprintf()?

OF COURSE, that will run faster if you define a function which will do just
the minimum you need. But is it really worth the time and risk of bug?

Unless that function is in a tight loop, I would rather use sprintf()… Any
objections?

Mat

-----Original Message-----
From: Christiaan Ghijselinck [mailto:xxxxx@CompaqNet.be]
Sent: Wednesday, April 16, 2003 2:12 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Ho, here we go …

I hope that the ( two ) question poster guy(s) didn’t commit suicide after
all previous comments … :)))

Christiaan

/----------------------------------------------------------------------
----
-------------------
/

UCHAR aValToCharConverter[16] = {
‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘A’,‘B’,‘C’,‘D’,‘E’,‘F’ } ;

VOID ConvertSequence ( IN ULONG nBinarySequenceSize ,
IN PVOID
pBinarySequence ,

# pragma pack ( 1 )
typedef UCHAR UCHARARRAY ;
typedef UCHARARRAY pUCHARARRAY ;
# pragma pack ( )

CCHAR _cSequenceBuffer[128]; // OUTPUT

UCHAR _bytevalue ;
UCHAR _lnibble ;
UCHAR _hnibble ;

ULONG _binindex ;

/
convert the binary strings into character strings /

for ( _binindex = 0 ; _binindex < nBinarySequenceSize ; _binindex++ )
{
/
next code seems to generate the smallest amount of ASM instructions
/
_bytevalue = (
(pUCHARARRAY)pBinarySequence)[_binindex] ;

_lnibble = aValToCharConverter[_bytevalue & 0x0F] ;
_hnibble = aValToCharConverter[_bytevalue >> 4] ;

_cSequenceBuffer[(_binindex << 1)] = _hnibble ;
_cSequenceBuffer[(_binindex << 1) + 1] = _lnibble ;
}

_cSequenceBuffer[nBinarySequenceSize << 1] = 0 ; /* string closing zero
*/



}

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Wednesday, April 16, 2003 6:40 PM
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

> Here, a very simple function - three lines of code - and a naive C++
tester
> to go with it. The “issue” call puts the characters out, one by one.
You
> guys can convert it to assembler if you will, but I don’t think it’s
> necessary.
>
> Hope this helps !
>
> Alberto.
>
> //==============================================================
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> } //==============================================================
>
> //==============================================================
> #include
> using namespace std;
>
> #define BUFFERSIZE 16
>
> static char c[BUFFERSIZE];
> static int p=0;
>
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> }
>
> void prime()
> {
> p = 0;
> for (int i=0; i> }
>
> void issue(int digit)
> {
> c[p++] = digit;
> c[p] = 0;
> }
>
>
> main()
> {
> prime(); convert(0); cout << c << endl;
> prime(); convert(0x1); cout << c << endl;
> prime(); convert(0x12); cout << c << endl;
> prime(); convert(0x123); cout << c << endl;
>
> return 0;
> } //==============================================================
>
> ----Original Message-----
> From: Daniel E. Germann [mailto:xxxxx@nospam.visi.com]
> Sent: Wednesday, April 16, 2003 9:10 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> Ahem. Allow me to kick myself in the pants. Please accept this
correction:
> add al,90h
> daa
> adc al,40h
> daa
>
> -Dan
>
> ----- Original Message -----
> From: “Daniel E. Germann”
> To: “NT Developers Interest List”
> Sent: Wednesday, April 16, 2003 8:06 AM
> Subject: Re: Binary/Hex to ASCII conversion in driver
>
>
> > OK, don’t flame me. My favorite binary-to-ASCII conversion on the
x86
> > platform is to put the 4-bit binary value I want to convert to ASCII
in
> the
> > AX register and then do:
> >
> > add al,40h
> > daa
> > adc al,90h
> > daa
> >
> > The result is an ASCII hex digit in the AX register. It’s not
portable,
> but
> > it is a nifty piece of code.
> >
> > I think credit for this goes to Tim Paterson at Seattle Computer
Products
> > (circa 1980). At least that’s the first reference I saw to this
> particular
> > method.
> >
> > -Dan
> >
> > ----- Original Message -----
> > > Subject: Binary/Hex to ASCII conversion in driver
> > > From: Tom Pr
> > > Date: Tue, 15 Apr 2003 16:36:02 -0700 (PDT)
> > >
> > > Hi All,
> > >
> > > How should I convert my 8 bit binary/Hex value to corresponding
> > > ASCII in my device driver.
>
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only.
It
> contains information that may be confidential. Unless you are the
named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


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


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


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


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


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


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


You are currently subscribed to ntdev as: xxxxx@xiotech.com To
unsubscribe send a blank email to xxxxx@lists.osr.com</stdio.h>

Well, if you know any debugging method that’s more effective than single
stepping through code, hey, just write that debugger and you’ll be rich and
famous in no time. Meanwhile, the rest of us will be toggling in the next
instruction through that magic keypress: call it a “run” switch or F5, it’s
exactly the same thing. Why do you think the Numega founders called it
“Soft” ICE ?

And unless you’re developing under Linux, that “use the source, dude”
statement doesn’t apply: we do not have the source for the OS, and yet we
have to debug through it. So, it’s back to machine code: writing it in C
does not excuse anyone from knowing the machine’s architecture and machine
code.

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Wednesday, April 16, 2003 7:11 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

But Alberto you use C … hell … you use assembly … you use SI … you
don’t sit there with a switch lite panel and toggle in every frigging
instruction and hit run … to toggle in the NEXT frigging instruction and
hit run … to toggle in the NEXT frigging instruction and hit run … to
toggle in the NEXT frigging instruction and hit run … to toggle in the
NEXT frigging instruction and hit run … to toggle in the NEXT frigging
instruction and hit run … to toggle in the NEXT frigging instruction and
hit run … to toggle in the NEXT frigging instruction and hit run … to
toggle in the NEXT frigging instruction and hit run … to toggle in the
NEXT frigging instruction and hit run … to toggle in the NEXT frigging
instruction and hit run … to toggle in the NEXT frigging instruction and
hit run … to toggle in the NEXT frigging instruction and hit run … to
toggle in the NEXT frigging instruction and hit run … to toggle in the
NEXT frigging instruction and hit run … to toggle in the NEXT frigging
instruction and hit run … to toggle in the NEXT frigging instruction and
hit run … to toggle in the NEXT frigging instruction and hit run … to
toggle in the NEXT frigging instruction and hit run … to toggle in the
NEXT frigging instruction and hit run … to toggle in the NEXT frigging
instruction and hit run … to toggle in the NEXT frigging instruction and
hit run … to toggle in the NEXT frigging instruction and hit run … to
toggle in the NEXT frigging instruction and hit run … to toggle in the
NEXT frigging instruction and hit run … to toggle in the NEXT frigging
instruction and hit run … to toggle in the NEXT frigging instruction and
hit run … to toggle in the NEXT frigging instruction and hit run … to
toggle in the NEXT frigging instruction and hit run … to toggle in the
NEXT frigging instruction and hit run … to toggle in the NEXT frigging
instruction and hit run … to toggle in the NEXT frigging instruction and
hit run … to toggle in the NEXT frigging instruction and hit run … to
toggle in the NEXT frigging instruction and hit run … to toggle in the
NEXT frigging instruction and hit run … to toggle in the NEXT frigging
instruction and hit run

:slight_smile:

well … you might … but I’d rather use a compiler and the tools
avaliable.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> Well…
>
> (1) It’s my code, and I trust my hand better than anyone else’s, (2) I
don’t
> use anything in my service routines that’s not strictly ANSI C, so, I
don’t
> depend on someone else’s headers, (3) I can tailor it exactly to what I
> need, (4) I can give my file a .cpp extension and take advantage of C++
> features not available in C, and (5) I can write it an test it in way less
> time it would take me to learn how sprintf works or what’s the semantics
of
> the Microsoft types.
>
> It may be my own professional bias, but I like to minimize the number of
> strings attached to my code !
>
> Alberto.
>
>
>
> -----Original Message-----
> From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
> Sent: Wednesday, April 16, 2003 2:29 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> What’s the point in writing that kind of code when you could simply
#include
> <stdio.h> and call sprintf()?
>
> OF COURSE, that will run faster if you define a function which will do
just
> the minimum you need. But is it really worth the time and risk of bug?
>
> Unless that function is in a tight loop, I would rather use sprintf()…
> Any objections?
>
> Mat
>
> -----Original Message-----
> From: Christiaan Ghijselinck [mailto:xxxxx@CompaqNet.be]
> Sent: Wednesday, April 16, 2003 2:12 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> Ho, here we go …
>
> I hope that the ( two ) question poster guy(s) didn’t commit suicide after
> all previous comments … :)))
>
> Christiaan
>
>
/--------------------------------------------------------------------------
> -------------------
/
>
>
> UCHAR aValToCharConverter[16] = {
> ‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘A’,‘B’,‘C’,‘D’,‘E’,‘F’ } ;
>
> VOID ConvertSequence ( IN ULONG nBinarySequenceSize ,
> IN PVOID
> pBinarySequence ,
>
>
> # pragma pack ( 1 )
> typedef UCHAR UCHARARRAY ;
> typedef UCHARARRAY pUCHARARRAY ;
> # pragma pack ( )
>
> CCHAR _cSequenceBuffer[128]; // OUTPUT
>
> UCHAR _bytevalue ;
> UCHAR _lnibble ;
> UCHAR _hnibble ;
>
> ULONG _binindex ;
>
>
> /
convert the binary strings into character strings /
>
> for ( _binindex = 0 ; _binindex < nBinarySequenceSize ; _binindex++ )
> {
> /
next code seems to generate the smallest amount of ASM
instructions
> /
> _bytevalue = (
(pUCHARARRAY)pBinarySequence)[_binindex] ;
>
> _lnibble = aValToCharConverter[_bytevalue & 0x0F] ;
> _hnibble = aValToCharConverter[_bytevalue >> 4] ;
>
> _cSequenceBuffer[(_binindex << 1)] = _hnibble ;
> _cSequenceBuffer[(_binindex << 1) + 1] = _lnibble ;
> }
>
> _cSequenceBuffer[nBinarySequenceSize << 1] = 0 ; /* string closing zero
> */
>
>
> …
>
>
> }
>
>
>
>
>
>
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “NT Developers Interest List”
> Sent: Wednesday, April 16, 2003 6:40 PM
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> > Here, a very simple function - three lines of code - and a naive C++
> tester
> > to go with it. The “issue” call puts the characters out, one by one. You
> > guys can convert it to assembler if you will, but I don’t think it’s
> > necessary.
> >
> > Hope this helps !
> >
> > Alberto.
> >
> > //==============================================================
> > void convert(int n)
> > {
> > char *k = “0123456789ABCDEF”;
> > if (n > 15) convert(n>>4);
> > issue (k[n&0xf]);
> > }
> > //==============================================================
> >
> > //==============================================================
> > #include
> > using namespace std;
> >
> > #define BUFFERSIZE 16
> >
> > static char c[BUFFERSIZE];
> > static int p=0;
> >
> > void convert(int n)
> > {
> > char *k = “0123456789ABCDEF”;
> > if (n > 15) convert(n>>4);
> > issue (k[n&0xf]);
> > }
> >
> > void prime()
> > {
> > p = 0;
> > for (int i=0; i> > }
> >
> > void issue(int digit)
> > {
> > c[p++] = digit;
> > c[p] = 0;
> > }
> >
> >
> > main()
> > {
> > prime(); convert(0); cout << c << endl;
> > prime(); convert(0x1); cout << c << endl;
> > prime(); convert(0x12); cout << c << endl;
> > prime(); convert(0x123); cout << c << endl;
> >
> > return 0;
> > }
> > //==============================================================
> >
> > ----Original Message-----
> > From: Daniel E. Germann [mailto:xxxxx@nospam.visi.com]
> > Sent: Wednesday, April 16, 2003 9:10 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> >
> > Ahem. Allow me to kick myself in the pants. Please accept this
> correction:
> > add al,90h
> > daa
> > adc al,40h
> > daa
> >
> > -Dan
> >
> > ----- Original Message -----
> > From: “Daniel E. Germann”
> > To: “NT Developers Interest List”
> > Sent: Wednesday, April 16, 2003 8:06 AM
> > Subject: Re: Binary/Hex to ASCII conversion in driver
> >
> >
> > > OK, don’t flame me. My favorite binary-to-ASCII conversion on the x86
> > > platform is to put the 4-bit binary value I want to convert to ASCII
in
> > the
> > > AX register and then do:
> > >
> > > add al,40h
> > > daa
> > > adc al,90h
> > > daa
> > >
> > > The result is an ASCII hex digit in the AX register. It’s not
portable,
> > but
> > > it is a nifty piece of code.
> > >
> > > I think credit for this goes to Tim Paterson at Seattle Computer
> Products
> > > (circa 1980). At least that’s the first reference I saw to this
> > particular
> > > method.
> > >
> > > -Dan
> > >
> > > ----- Original Message -----
> > > > Subject: Binary/Hex to ASCII conversion in driver
> > > > From: Tom Pr
> > > > Date: Tue, 15 Apr 2003 16:36:02 -0700 (PDT)
> > > >
> > > > Hi All,
> > > >
> > > > How should I convert my 8 bit binary/Hex value to
> > > > corresponding ASCII in my device driver.
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> xxxxx@compaqnet.be
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@guillemot.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.</stdio.h>

Of course FORTH is the language of choice. For anything. Didn’t you guys
know that already ? Why should I use printf if I can use “. cr” ?

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Wednesday, April 16, 2003 6:59 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Justin … don’t be silly … FORTH is always the language of choice.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Justin Frodsham” wrote in message news:xxxxx@ntdev…
>
> Very funny… first though… if you want to write a really good
> driver you need to use LOGO as your programming language. VB is way too
> low level.
>
> -J
>
> At 03:34 PM 4/15/2003, you wrote:
> >I want to write an encrypting file system driver. I have written
> >several hello world programs in VB before. What do I need to know to do
> >this?
> >
> >Thanks,
> >Rob
> >
> >
> >
> >
> >:)
> >
> >-----Original Message-----
> >From: xxxxx@lists.osr.com
> >[mailto:xxxxx@lists.osr.com] On Behalf Of Justin Frodsham
> >Sent: Tuesday, April 15, 2003 8:06 PM
> >To: NT Developers Interest List
> >Subject: [ntdev] RE: Binary/Hex to ASCII conversion in driver
> >
> >Are there any of us here that have not asked a dumb question at some
> >point
> >in life??.. Were you born with computer knowledge or did you have to
> >
> >learn like the rest of us?
> >
> >-Justin
> >
> >At 01:58 PM 4/15/2003, you wrote:
> > >My apologies, there are no stupid questions; only inquisitive idiots.
> > >
> > >Jamey
> > >
> > >
> > >-----Original Message-----
> > >From: xxxxx@lists.osr.com
> > >[mailto:xxxxx@lists.osr.com] On Behalf Of Tom Pr
> > >Sent: Tuesday, April 15, 2003 4:36 PM
> > >To: NT Developers Interest List
> > >Subject: [ntdev] Binary/Hex to ASCII conversion in driver
> > >
> > >Hi All,
> > >
> > >How should I convert my 8 bit binary/Hex value to
> > >corresponding ASCII in my device driver.
> > >
> > >
> > > __________________________________________________
> > >Do you Yahoo!?
> > >The New Yahoo! Search - Faster. Easier. Bingo
> > >http://search.yahoo.com
> > >
> > >
> > >—
> > >You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > >—
> > >You are currently subscribed to ntdev as: zeppelin@io.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> >
> >—
> >You are currently subscribed to ntdev as: xxxxx@cdp.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >—
> >You are currently subscribed to ntdev as: zeppelin@io.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
>


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Yes, but I would rather trust code that has had 10 years of debugging
and real world experience, rather than your code, no matter how good a
programmer you are. You like C++ over C because it makes your life
easier. Using already written code (and this IS the bonus) already
debugged code, makes my life easier.

I have an engineer on my team that thinks like you do, and we are
constantly doing friendly fire on the code he writes because he doesn’t
trust the clib function, so he writes new ones. I have yet to find a
bug in the code from the OS (Simple functions, like RtlMoveMemory,
sprintf, etc…). Yet every single time he does this, I find bugs in his
code. This increases the time it takes to debug the code, and comes
back later as a bug, which is very expensive.

My motto is…

Unless you have reason to suspect a piece of code, assume it works.

Otherwise you will be questioning how Mov eax,1 every works (which he
also does!) and never be able to write new code, because you are
reinventing the wheel (and this is my personal opinion) it is never
better than the code that is already written and debugged.

Thanks,
Rob

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Moreira, Alberto
Sent: Thursday, April 17, 2003 10:24 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

By the time I went through all those gyrations, I might as well have
written
my own code.

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Thursday, April 17, 2003 12:49 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Well sir, given that _vsnprintf is available in your target platform …
copy
the bloody files into your working directory, set the frigging compile
switch and COMPILE. :slight_smile: They give us the SOURCE code for the functions.


Gary G. Little
Have Computer, will travel …
(909) 6983191
(909) 5512105
http://www.wd-3.com

“Jamey Kirby” wrote in message
news:xxxxx@ntdev…
>
> I guess if you have the luxury of only using XP and Server 2003, these
> are OK, but if downward compatibility is an issue, they are useless.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
> Sent: Wednesday, April 16, 2003 3:55 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
> But better to use the functions found in NTSTRSAFE.H and
NTSTRSAFE.LIB.
>
> char SzGuidToPrint[GUID_SIZE];
> NTSTATUS status;
>
> status = RtlStringCchPrintfW(SzGuidToPrint, sizeof(SzGuidToPrint),
> L"%08lx",
> Guid.Data1);
>
> Read next months article in Windows Driver Developers Digest.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> “Jamey Kirby” wrote in message
> news:xxxxx@ntdev…
> >
> > Enough sarcasm; I guess…
> >
> > I think he may be looking for ACII character representation of a
> number
> > like 100 -> “100” for a printable string or something.
> >
> > You can do it the hard way or you can use various sprintf like
> functions
> > to do the formatting for you.
> >
> > In some of our drivers, we have code like this:
> >
> > swprintf(SzGuidToPrint, L"%08lx", Guid.Data1);
> >
> > where SzGuidToPrint is a string representation of the value.
> >
> > Jamey
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jamey Kirby
> > Sent: Tuesday, April 15, 2003 5:21 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > Does it matter :slight_smile:
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Justin Frodsham
> > Sent: Tuesday, April 15, 2003 5:00 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > I am not certain you have supplied enough information answer the
> > question. What are you trying to do? ASCII can be represented by
an
> > 8bit
> > binary/hex value… So I don’t understand what you are trying to
> > convert
> > from/to.
> >
> > -Justin
> >
> > At 01:36 PM 4/15/2003, you wrote:
> > >Hi All,
> > >
> > >How should I convert my 8 bit binary/Hex value to
> > >corresponding ASCII in my device driver.
> > >
> > >
> > > __________________________________________________
> > >Do you Yahoo!?
> > >The New Yahoo! Search - Faster. Easier. Bingo
> > >http://search.yahoo.com
> > >
> > >
> > >—
> > >You are currently subscribed to ntdev as: zeppelin@io.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>


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

The contents of this e-mail are intended for the named addressee only.
It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or
disclose
it to anyone else. If you received it in error please notify us
immediately
and then destroy it.


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

“Jamey Kirby” wrote in message news:xxxxx@ntdev…
>
> I guess if you have the luxury of only using XP and Server 2003, these
> are OK, but if downward compatibility is an issue, they are useless.

Not true. They can be inlined or used as a library with XP and later. They
are provided in the 2000 pieces of the current DDK as a library only. Look
at the docs in the WS 2K3 DDK (3790), it clearly spells this out.


Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.

How about a more platform independant reliable language like Java… for
writing
device drivers… :slight_smile: that should make the yoyo

----- Original Message -----
From: “Rob Green”
To: “NT Developers Interest List”
Sent: Thursday, April 17, 2003 2:54 PM
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

> Yes, but I would rather trust code that has had 10 years of debugging
> and real world experience, rather than your code, no matter how good a
> programmer you are. You like C++ over C because it makes your life
> easier. Using already written code (and this IS the bonus) already
> debugged code, makes my life easier.
>
> I have an engineer on my team that thinks like you do, and we are
> constantly doing friendly fire on the code he writes because he doesn’t
> trust the clib function, so he writes new ones. I have yet to find a
> bug in the code from the OS (Simple functions, like RtlMoveMemory,
> sprintf, etc…). Yet every single time he does this, I find bugs in his
> code. This increases the time it takes to debug the code, and comes
> back later as a bug, which is very expensive.
>
> My motto is…
>
> Unless you have reason to suspect a piece of code, assume it works.
>
> Otherwise you will be questioning how Mov eax,1 every works (which he
> also does!) and never be able to write new code, because you are
> reinventing the wheel (and this is my personal opinion) it is never
> better than the code that is already written and debugged.
>
> Thanks,
> Rob
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Moreira, Alberto
> Sent: Thursday, April 17, 2003 10:24 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
> By the time I went through all those gyrations, I might as well have
> written
> my own code.
>
> Alberto.
>
>
> -----Original Message-----
> From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> Sent: Thursday, April 17, 2003 12:49 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> Well sir, given that _vsnprintf is available in your target platform …
> copy
> the bloody files into your working directory, set the frigging compile
> switch and COMPILE. :slight_smile: They give us the SOURCE code for the functions.
>
> –
> Gary G. Little
> Have Computer, will travel …
> (909) 6983191
> (909) 5512105
> http://www.wd-3.com
>
> “Jamey Kirby” wrote in message
> news:xxxxx@ntdev…
> >
> > I guess if you have the luxury of only using XP and Server 2003, these
> > are OK, but if downward compatibility is an issue, they are useless.
> >
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
> > Sent: Wednesday, April 16, 2003 3:55 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > But better to use the functions found in NTSTRSAFE.H and
> NTSTRSAFE.LIB.
> >
> > char SzGuidToPrint[GUID_SIZE];
> > NTSTATUS status;
> >
> > status = RtlStringCchPrintfW(SzGuidToPrint, sizeof(SzGuidToPrint),
> > L"%08lx",
> > Guid.Data1);
> >
> > Read next months article in Windows Driver Developers Digest.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> > http://www.wd-3.com
> >
> > “Jamey Kirby” wrote in message
> > news:xxxxx@ntdev…
> > >
> > > Enough sarcasm; I guess…
> > >
> > > I think he may be looking for ACII character representation of a
> > number
> > > like 100 -> “100” for a printable string or something.
> > >
> > > You can do it the hard way or you can use various sprintf like
> > functions
> > > to do the formatting for you.
> > >
> > > In some of our drivers, we have code like this:
> > >
> > > swprintf(SzGuidToPrint, L"%08lx", Guid.Data1);
> > >
> > > where SzGuidToPrint is a string representation of the value.
> > >
> > > Jamey
> > >
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Jamey Kirby
> > > Sent: Tuesday, April 15, 2003 5:21 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> > >
> > > Does it matter :slight_smile:
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Justin Frodsham
> > > Sent: Tuesday, April 15, 2003 5:00 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> > >
> > > I am not certain you have supplied enough information answer the
> > > question. What are you trying to do? ASCII can be represented by
> an
> > > 8bit
> > > binary/hex value… So I don’t understand what you are trying to
> > > convert
> > > from/to.
> > >
> > > -Justin
> > >
> > > At 01:36 PM 4/15/2003, you wrote:
> > > >Hi All,
> > > >
> > > >How should I convert my 8 bit binary/Hex value to
> > > >corresponding ASCII in my device driver.
> > > >
> > > >
> > > > __________________________________________________
> > > >Do you Yahoo!?
> > > >The New Yahoo! Search - Faster. Easier. Bingo
> > > >http://search.yahoo.com
> > > >
> > > >
> > > >—
> > > >You are currently subscribed to ntdev as: zeppelin@io.com
> > > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only.
> It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
> disclose
> it to anyone else. If you received it in error please notify us
> immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@cdp.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@bemac.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

I hate to pipe in when I don’t have anything constructive to add…but, I’m
going to agree. But at least Tom made me smile today.

Shaun

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Swanson, Tom
Sent: Thursday, April 17, 2003 7:27 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

I was just wondering how this thread could get any more irritating. A shift
to C vs C++ should do the trick.

Tom

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Thursday, April 17, 2003 9:22 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Howso ? It’s easier to write C++ code than it is to write C code. The
availability of inheritance and polymorphism makes writing complex code a
lot easier.

Alberto.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, April 16, 2003 9:31 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

I think you are using C++ for the wrong reasons then.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Moreira, Alberto
Sent: Wednesday, April 16, 2003 1:50 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

A couple of things, yet first beware, I’m a minimalist. Before I did video
drivers for a living, I was a Bios programmer, so, you know where I’m coming
from ! I only use something if I’m forced to, and even then, I’ll only use
it screaming and kicking. My personal take on this is, and I don’t ask
anyone to follow me, Operating Systems and Runtime Libraries are there to be
bypassed: the best OS is the one I can take for granted and that doesn’t
stand on my way when I need to do something funky.

But on to specifics,

(1) This is Alberto speaking, not Compuware.
(2) I should have been more specific: I don’t like to use C libraries in
kernel code either.
(5) I have been using iostreams and cin/cout like stuff long enough that I
no longer care for printf and its relatives. And guess what, apart from a
few specific formats, I ignore the bulk of that functionality: I don’t need
it, and it’s been many moons since I last included stdio.h in my code.

And also, no, using sprintf doesn’t save time, not to me anyway: I wrote the
binary-to-ascii routine I emailed to you guys in less than a minute, and it
worked first time. Hence, why bother with sprintf ? It’s clunkier, it adds
lots of unused baggage, and it takes me longer to debug because it’s not my
code nor my semantics. Also, I can’t help to a feeling of writing dirty code
if I invoke a C library routine from inside one of my C++ classes. But then,
hey, that’s a personal thing.

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 4:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Mm let me think…

(1) It’s my code, and I trust my hand better than anyone else’s

Coming from the mouth of someone who pushes a certain driver framework
library, that statement seems contradictory.

(2) I don’t
use anything in my service routines that’s not strictly ANSI C, so, I
don’t
depend on someone else’s headers,

sprintf() is ANSI C. Isn’t it?
http://www.lysator.liu.se/c/rat/d9.html#4-9-6-5

(5) I can write it an test it in way less
time it would take me to learn how sprintf works or what’s the
semantics of
the Microsoft types.

I thought everyone who learned C/C++ was familiar with the printf()
function. Maybe I shouldn’t make that assumption? In any case, learning
sprintf() is definitely worth the effort: it will save you time every single
occasion where you need to format data into a string! You won’t even need
to write a special function. sprintf() must be the standard function I use
the most.

Mat

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Wednesday, April 16, 2003 3:55 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Well…

(1) It’s my code, and I trust my hand better than anyone else’s, (2) I don’t
use anything in my service routines that’s not strictly ANSI C, so, I don’t
depend on someone else’s headers, (3) I can tailor it exactly to what I
need, (4) I can give my file a .cpp extension and take advantage of C++
features not available in C, and (5) I can write it an test it in way less
time it would take me to learn how sprintf works or what’s the semantics of
the Microsoft types.

It may be my own professional bias, but I like to minimize the number of
strings attached to my code !

Alberto.

-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, April 16, 2003 2:29 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

What’s the point in writing that kind of code when you could simply #include
<stdio.h> and call sprintf()?

OF COURSE, that will run faster if you define a function which will do just
the minimum you need. But is it really worth the time and risk of bug?

Unless that function is in a tight loop, I would rather use sprintf()… Any
objections?

Mat

-----Original Message-----
From: Christiaan Ghijselinck [mailto:xxxxx@CompaqNet.be]
Sent: Wednesday, April 16, 2003 2:12 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Ho, here we go …

I hope that the ( two ) question poster guy(s) didn’t commit suicide after
all previous comments … :)))

Christiaan

/----------------------------------------------------------------------
----
-------------------
/

UCHAR aValToCharConverter[16] = {
‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘A’,‘B’,‘C’,‘D’,‘E’,‘F’ } ;

VOID ConvertSequence ( IN ULONG nBinarySequenceSize ,
IN PVOID
pBinarySequence ,

# pragma pack ( 1 )
typedef UCHAR UCHARARRAY ;
typedef UCHARARRAY pUCHARARRAY ;
# pragma pack ( )

CCHAR _cSequenceBuffer[128]; // OUTPUT

UCHAR _bytevalue ;
UCHAR _lnibble ;
UCHAR _hnibble ;

ULONG _binindex ;

/
convert the binary strings into character strings /

for ( _binindex = 0 ; _binindex < nBinarySequenceSize ; _binindex++ )
{
/
next code seems to generate the smallest amount of ASM instructions
/
_bytevalue = (
(pUCHARARRAY)pBinarySequence)[_binindex] ;

_lnibble = aValToCharConverter[_bytevalue & 0x0F] ;
_hnibble = aValToCharConverter[_bytevalue >> 4] ;

_cSequenceBuffer[(_binindex << 1)] = _hnibble ;
_cSequenceBuffer[(_binindex << 1) + 1] = _lnibble ;
}

_cSequenceBuffer[nBinarySequenceSize << 1] = 0 ; /* string closing zero
*/



}

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Wednesday, April 16, 2003 6:40 PM
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

> Here, a very simple function - three lines of code - and a naive C++
tester
> to go with it. The “issue” call puts the characters out, one by one.
You
> guys can convert it to assembler if you will, but I don’t think it’s
> necessary.
>
> Hope this helps !
>
> Alberto.
>
> //==============================================================
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> } //==============================================================
>
> //==============================================================
> #include
> using namespace std;
>
> #define BUFFERSIZE 16
>
> static char c[BUFFERSIZE];
> static int p=0;
>
> void convert(int n)
> {
> char *k = “0123456789ABCDEF”;
> if (n > 15) convert(n>>4);
> issue (k[n&0xf]);
> }
>
> void prime()
> {
> p = 0;
> for (int i=0; i> }
>
> void issue(int digit)
> {
> c[p++] = digit;
> c[p] = 0;
> }
>
>
> main()
> {
> prime(); convert(0); cout << c << endl;
> prime(); convert(0x1); cout << c << endl;
> prime(); convert(0x12); cout << c << endl;
> prime(); convert(0x123); cout << c << endl;
>
> return 0;
> } //==============================================================
>
> ----Original Message-----
> From: Daniel E. Germann [mailto:xxxxx@nospam.visi.com]
> Sent: Wednesday, April 16, 2003 9:10 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
>
>
> Ahem. Allow me to kick myself in the pants. Please accept this
correction:
> add al,90h
> daa
> adc al,40h
> daa
>
> -Dan
>
> ----- Original Message -----
> From: “Daniel E. Germann”
> To: “NT Developers Interest List”
> Sent: Wednesday, April 16, 2003 8:06 AM
> Subject: Re: Binary/Hex to ASCII conversion in driver
>
>
> > OK, don’t flame me. My favorite binary-to-ASCII conversion on the
x86
> > platform is to put the 4-bit binary value I want to convert to ASCII
in
> the
> > AX register and then do:
> >
> > add al,40h
> > daa
> > adc al,90h
> > daa
> >
> > The result is an ASCII hex digit in the AX register. It’s not
portable,
> but
> > it is a nifty piece of code.
> >
> > I think credit for this goes to Tim Paterson at Seattle Computer
Products
> > (circa 1980). At least that’s the first reference I saw to this
> particular
> > method.
> >
> > -Dan
> >
> > ----- Original Message -----
> > > Subject: Binary/Hex to ASCII conversion in driver
> > > From: Tom Pr
> > > Date: Tue, 15 Apr 2003 16:36:02 -0700 (PDT)
> > >
> > > Hi All,
> > >
> > > How should I convert my 8 bit binary/Hex value to corresponding
> > > ASCII in my device driver.
>
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only.
It
> contains information that may be confidential. Unless you are the
named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as:
xxxxx@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


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


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


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


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


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


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


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


You are currently subscribed to ntdev as: xxxxx@tenpennies.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</stdio.h>

nothing more fun than beating a dead horse. Except perhaps poking it
with a stick afterwards for a while and then beating it again. THen
spraying it with the hose.

does it really matter who has the superior development philosophy?

-p

-----Original Message-----
From: Rob Green [mailto:xxxxx@cdp.com]
Sent: Thursday, April 17, 2003 7:55 AM
To: NT Developers Interest List

Yes, but I would rather trust code that has had 10 years of
debugging and real world experience, rather than your code,
no matter how good a programmer you are. You like C++ over C
because it makes your life easier. Using already written
code (and this IS the bonus) already debugged code, makes my
life easier.

I have an engineer on my team that thinks like you do, and we
are constantly doing friendly fire on the code he writes
because he doesn’t trust the clib function, so he writes new
ones. I have yet to find a bug in the code from the OS
(Simple functions, like RtlMoveMemory, sprintf, etc…). Yet
every single time he does this, I find bugs in his code.
This increases the time it takes to debug the code, and comes
back later as a bug, which is very expensive.

My motto is…

Unless you have reason to suspect a piece of code, assume it works.

Otherwise you will be questioning how Mov eax,1 every works
(which he also does!) and never be able to write new code,
because you are reinventing the wheel (and this is my
personal opinion) it is never better than the code that is
already written and debugged.

Thanks,
Rob

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Moreira, Alberto
Sent: Thursday, April 17, 2003 10:24 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

By the time I went through all those gyrations, I might as
well have written my own code.

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Thursday, April 17, 2003 12:49 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

Well sir, given that _vsnprintf is available in your target
platform …
copy
the bloody files into your working directory, set the
frigging compile switch and COMPILE. :slight_smile: They give us the
SOURCE code for the functions.


Gary G. Little
Have Computer, will travel …
(909) 6983191
(909) 5512105
http://www.wd-3.com

“Jamey Kirby” wrote in message
> news:xxxxx@ntdev…
> >
> > I guess if you have the luxury of only using XP and Server
> 2003, these
> > are OK, but if downward compatibility is an issue, they are useless.
> >
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
> > Sent: Wednesday, April 16, 2003 3:55 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> >
> > But better to use the functions found in NTSTRSAFE.H and
> NTSTRSAFE.LIB.
> >
> > char SzGuidToPrint[GUID_SIZE];
> > NTSTATUS status;
> >
> > status = RtlStringCchPrintfW(SzGuidToPrint, sizeof(SzGuidToPrint),
> > L"%08lx", Guid.Data1);
> >
> > Read next months article in Windows Driver Developers Digest.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> > http://www.wd-3.com
> >
> > “Jamey Kirby” wrote in message
> > news:xxxxx@ntdev…
> > >
> > > Enough sarcasm; I guess…
> > >
> > > I think he may be looking for ACII character representation of a
> > number
> > > like 100 -> “100” for a printable string or something.
> > >
> > > You can do it the hard way or you can use various sprintf like
> > functions
> > > to do the formatting for you.
> > >
> > > In some of our drivers, we have code like this:
> > >
> > > swprintf(SzGuidToPrint, L"%08lx", Guid.Data1);
> > >
> > > where SzGuidToPrint is a string representation of the value.
> > >
> > > Jamey
> > >
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Jamey Kirby
> > > Sent: Tuesday, April 15, 2003 5:21 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> > >
> > > Does it matter :slight_smile:
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of
> Justin Frodsham
> > > Sent: Tuesday, April 15, 2003 5:00 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver
> > >
> > > I am not certain you have supplied enough information answer the
> > > question. What are you trying to do? ASCII can be represented by
> an
> > > 8bit
> > > binary/hex value… So I don’t understand what you are
> trying to
> > > convert from/to.
> > >
> > > -Justin
> > >
> > > At 01:36 PM 4/15/2003, you wrote:
> > > >Hi All,
> > > >
> > > >How should I convert my 8 bit binary/Hex value to corresponding
> > > >ASCII in my device driver.
> > > >
> > > >
> > > > __________________________________________________
> > > >Do you Yahoo!?
> > > >The New Yahoo! Search - Faster. Easier. Bingo
> > > >http://search.yahoo.com
> > > >
> > > >
> > > >—
> > > >You are currently subscribed to ntdev as: zeppelin@io.com To
> > > >unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
> xxxxx@storagecraft.com To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
> xxxxx@storagecraft.com To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> xxxxx@storagecraft.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com To unsubscribe send a blank
> email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only.
> It
> contains information that may be confidential. Unless you are
> the named addressee or an authorized designee, you may not
> copy or use it, or disclose it to anyone else. If you
> received it in error please notify us immediately and then
> destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@cdp.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@microsoft.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>

> -----Original Message-----

From: Swanson, Tom [mailto:xxxxx@XIOtech.com]
Sent: Thursday, April 17, 2003 7:27 AM

I was just wondering how this thread could get any more
irritating. A shift
to C vs C++ should do the trick.

AAAAAAAAHHHHHHHH!!! NO NOT THAT!!!

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Thursday, April 17, 2003 9:22 AM

Howso ? It’s easier to write C++ code than it is to write C code. The
availability of inheritance and polymorphism makes writing
complex code a
lot easier.

Please, do not start this conversation again.

-----Original Message-----
From: Christine Ames [mailto:xxxxx@PacificDigital.com]
Sent: Thursday, April 17, 2003 11:31 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

-----Original Message-----
From: Swanson, Tom [mailto:xxxxx@XIOtech.com]
Sent: Thursday, April 17, 2003 7:27 AM

I was just wondering how this thread could get any more
irritating. A shift
to C vs C++ should do the trick.

AAAAAAAAHHHHHHHH!!! NO NOT THAT!!!

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Thursday, April 17, 2003 9:22 AM

Howso ? It’s easier to write C++ code than it is to write C code. The
availability of inheritance and polymorphism makes writing
complex code a
lot easier.


You are currently subscribed to ntdev as: chakradhar.kommuri@hp.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

>

does it really matter who has the superior development philosophy?

Nope, not at all, unless of course you are about quality of outcome.

On the other hand, who really thinks that using a WMI-event based tracing
scheme is a good idea for kernel driver debugging?

Other non-sequitors eagerly solicited.

Do not forget about the Turning Machine…

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Justin Frodsham
Sent: Wednesday, April 16, 2003 11:21 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Binary/Hex to ASCII conversion in driver

LOL…

At 12:59 PM 4/16/2003, you wrote:

Justin … don’t be silly … FORTH is always the language of choice.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Justin Frodsham” wrote in message
news:xxxxx@ntdev…
> >
> > Very funny… first though… if you want to write a really
good
> > driver you need to use LOGO as your programming language. VB is
way too
> > low level.
> >
> > -J
> >
> > At 03:34 PM 4/15/2003, you wrote:
> > >I want to write an encrypting file system driver. I have written
> > >several hello world programs in VB before. What do I need to know
to do
> > >this?
> > >
> > >Thanks,
> > >Rob


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