buffer(Albert's question)

Well,

If you are still stuck, please put the exact code and the corresponding
KdPrint() print out after copy pasting or from a redirected log file of
windbg output.

I would also recommend to try printing out something in hex form for those
indeces. Off hand I dont remember the behavior of printf *for
non-printable ascii chars*.

-pro

members,

of hand I have created a lot of confusion amongst you just because of
a stupid typo error, and trying to reproduce the code by typing it.
well here is the original with the WinDbg output…

In global header the variable is declared as

#define SIZEB 3000000
PCHAR buffer;

in driver entry i allocate and initialize the buffer as

buffer=ExAllocatePool( NonPagedPoolCacheAligned ,SIZEB);
RtlFillBytes(buffer,SIZEB,‘1’);

In another function f00() that is called in some dispatcher, I write

if(buffer[OFFSET]==‘2’){
KdPrint((“\nindex is : %u”,OFFSET));
KdPrint((“\n buffer[%u] is : %c”,OFFSET,buffer[OFFSET]));
return 1;
}
else if(buffer[OFFSET]==‘1’){
KdPrint((\nindex is : %u",OFFSET));
KdPrint((“\n buffer[%u] is : %c”,OFFSET,buffer[OFFSET]));
return 0;
}
}

In the dispatcher for READ, I have…

KdPrint((“\n(READ)”));
foo(OFFSET);

here is the dump from WinDbg.

(READ)
index is : 955
buffer[955] is :

(READ)
index is : 963
buffer[963] is :

I am using debug (checked ) build and I am using WinDbg over a serial
cable conected at 19200 baud rate.

I cannot get the reason why in the debugger I never see the contents
of the location OFFSET!!!

-A

On 8/10/05, xxxxx@garlic.com wrote:
> Well,
>
> If you are still stuck, please put the exact code and the corresponding
> KdPrint() print out after copy pasting or from a redirected log file of
> windbg output.
>
> I would also recommend to try printing out something in hex form for those
> indeces. Off hand I dont remember the behavior of printf for
> non-printable ascii chars
.
>
> -pro
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>



- Developer

What datatype is OFFSET? Is it perhaps larger than int? If so you’ll
probably have 0’s on the stack in the location that printf’s checking
for the value to put in %c.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Developer
Sent: Wednesday, August 10, 2005 10:38 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] buffer(Albert’s question)

members,

of hand I have created a lot of confusion amongst you just because of a
stupid typo error, and trying to reproduce the code by typing it.
well here is the original with the WinDbg output…

In global header the variable is declared as

#define SIZEB 3000000
PCHAR buffer;

in driver entry i allocate and initialize the buffer as

buffer=ExAllocatePool( NonPagedPoolCacheAligned ,SIZEB);
RtlFillBytes(buffer,SIZEB,‘1’);

In another function f00() that is called in some dispatcher, I write

if(buffer[OFFSET]==‘2’){
KdPrint((“\nindex is : %u”,OFFSET));
KdPrint((“\n buffer[%u] is :
%c”,OFFSET,buffer[OFFSET]));
return 1;
}
else if(buffer[OFFSET]==‘1’){
KdPrint((\nindex is : %u",OFFSET));
KdPrint((“\n buffer[%u] is :
%c”,OFFSET,buffer[OFFSET]));
return 0;
}
}

In the dispatcher for READ, I have…

KdPrint((“\n(READ)”));
foo(OFFSET);

here is the dump from WinDbg.

(READ)
index is : 955
buffer[955] is :

(READ)
index is : 963
buffer[963] is :

I am using debug (checked ) build and I am using WinDbg over a serial
cable conected at 19200 baud rate.

I cannot get the reason why in the debugger I never see the contents of
the location OFFSET!!!

-A

On 8/10/05, xxxxx@garlic.com wrote:
> Well,
>
> If you are still stuck, please put the exact code and the
> corresponding
> KdPrint() print out after copy pasting or from a redirected log file
> of windbg output.
>
> I would also recommend to try printing out something in hex form for
> those indeces. Off hand I dont remember the behavior of printf for
> non-printable ascii chars
.
>
> -pro
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>



- Developer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Neither of the values ‘1’ or ‘2’ are printable characters. Change %c to %x.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Developer
Sent: Thursday, August 11, 2005 1:38 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] buffer(Albert’s question)

members,

of hand I have created a lot of confusion amongst you just
because of a stupid typo error, and trying to reproduce the
code by typing it.
well here is the original with the WinDbg output…

In global header the variable is declared as

#define SIZEB 3000000
PCHAR buffer;

in driver entry i allocate and initialize the buffer as

buffer=ExAllocatePool( NonPagedPoolCacheAligned ,SIZEB);
RtlFillBytes(buffer,SIZEB,‘1’);

In another function f00() that is called in some dispatcher, I write

if(buffer[OFFSET]==‘2’){
KdPrint((“\nindex is : %u”,OFFSET));
KdPrint((“\n buffer[%u] is :
%c”,OFFSET,buffer[OFFSET]));
return 1;
}
else if(buffer[OFFSET]==‘1’){
KdPrint((\nindex is : %u",OFFSET));
KdPrint((“\n buffer[%u] is :
%c”,OFFSET,buffer[OFFSET]));
return 0;
}
}

In the dispatcher for READ, I have…

KdPrint((“\n(READ)”));
foo(OFFSET);

here is the dump from WinDbg.

(READ)
index is : 955
buffer[955] is :
>
> (READ)
> index is : 963
> buffer[963] is :
>
>
>
> I am using debug (checked ) build and I am using WinDbg over
> a serial cable conected at 19200 baud rate.
>
> I cannot get the reason why in the debugger I never see the
> contents of the location OFFSET!!!
>
> -A
>
> On 8/10/05, xxxxx@garlic.com wrote:
> > Well,
> >
> > If you are still stuck, please put the exact code and the
> > corresponding
> > KdPrint() print out after copy pasting or from a redirected
> log file
> > of windbg output.
> >
> > I would also recommend to try printing out something in hex
> form for
> > those indeces. Off hand I dont remember the behavior of printf for
> > non-printable ascii chars
.
> >
> > -pro
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@gmail.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
> –
>
> - Developer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Not enough coffee this AM, Mark? ‘1’ is certainly a printable character.
It prints as 1. 0x01 is not, of course. His types are correct, he’s
indexing into a PCHAR, so there should be a char there.

To “Developer”
(I liked you better as Albert Pinto. You’ll get a lot more respect if you
read the posting guidelines at OSROnline and do what they say. Your
initiation of this thread is an excellent example of how NOT to post a
question on this list.)

Jan Bottorff caught a likely cause of your problem. You are expecting
either ‘1’ or ‘2’, you need to catch the case where it is any other value.
If you see that it’s any other value, use Mark’s suggestion to print the hex
value in the buffer. If you find that’s happening, you then need to figure
out why it’s not what you expect.

The MSDN docs say that RtlFillMemory is preferred over RtlFillBytes, if you
aren’t supporting Win9x.

Phil

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

“Mark Roddy” wrote in message news:xxxxx@ntdev…
> Neither of the values ‘1’ or ‘2’ are printable characters. Change %c to
> %x.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Developer
>> Sent: Thursday, August 11, 2005 1:38 AM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] buffer(Albert’s question)
>>
>> members,
>>
>> of hand I have created a lot of confusion amongst you just
>> because of a stupid typo error, and trying to reproduce the
>> code by typing it.
>> well here is the original with the WinDbg output…
>>
>>
>> In global header the variable is declared as
>>
>> #define SIZEB 3000000
>> PCHAR buffer;
>>
>> in driver entry i allocate and initialize the buffer as
>>
>> buffer=ExAllocatePool( NonPagedPoolCacheAligned ,SIZEB);
>> RtlFillBytes(buffer,SIZEB,‘1’);
>>
>> In another function f00() that is called in some dispatcher, I write
>>
>>
>>
>> if(buffer[OFFSET]==‘2’){
>> KdPrint((“\nindex is : %u”,OFFSET));
>> KdPrint((“\n buffer[%u] is :
>> %c”,OFFSET,buffer[OFFSET]));
>> return 1;
>> }
>> else if(buffer[OFFSET]==‘1’){
>> KdPrint((\nindex is : %u",OFFSET));
>> KdPrint((“\n buffer[%u] is :
>> %c”,OFFSET,buffer[OFFSET]));
>> return 0;
>> }
>> }
>>
>>
>>
>>
>>
>> In the dispatcher for READ, I have…
>>
>> KdPrint((“\n(READ)”));
>> foo(OFFSET);
>>
>>
>>
>>
>> here is the dump from WinDbg.
>>
>> (READ)
>> index is : 955
>> buffer[955] is :
>>
>> (READ)
>> index is : 963
>> buffer[963] is :
>>
>>
>>
>> I am using debug (checked ) build and I am using WinDbg over
>> a serial cable conected at 19200 baud rate.
>>
>> I cannot get the reason why in the debugger I never see the
>> contents of the location OFFSET!!!
>>
>> -A

Mark Roddy wrote:

Neither of the values ‘1’ or ‘2’ are printable characters. Change %c to %x.

Mark hasn’t had enough coffee today. ‘1’ is hex 0x31, and IS a
printable character…


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

Phil Barila wrote:

Jan Bottorff caught a likely cause of your problem. You are expecting
either ‘1’ or ‘2’, you need to catch the case where it is any other value.

But if the value was other than ‘1’ or ‘2’, there wouldn’t be any prints
at all. The fact that he is seeing KdPrints indicates that it must be
matching one of those values.

I wonder about his practice of including the \n at the beginning of the
string, rather than the end. In a perfect world, it shouldn’t make any
difference, but that would be one of the experiments I’d try, as well as
the suggestion of printing the hex. There are differences in behavior
between windbg, SoftIce, and dbmon when the newline is missing.

The MSDN docs say that RtlFillMemory is preferred over RtlFillBytes, if you
aren’t supporting Win9x.

Well, that’s just a “wishful thinking” note. If you look in ntddk.h,
you find:
#define RtlFillBytes RtlFillMemory


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

I’ll be committing ritual suicide in the parking lot, if anyone is
interested.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Phil Barila
Sent: Thursday, August 11, 2005 12:06 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] buffer(Albert’s question)

Not enough coffee this AM, Mark? ‘1’ is certainly a printable
character.
It prints as 1. 0x01 is not, of course. His types are correct, he’s
indexing into a PCHAR, so there should be a char there.

To “Developer”
(I liked you better as Albert Pinto. You’ll get a lot more respect if
you
read the posting guidelines at OSROnline and do what they say. Your
initiation of this thread is an excellent example of how NOT to post a
question on this list.)

Jan Bottorff caught a likely cause of your problem. You are expecting
either ‘1’ or ‘2’, you need to catch the case where it is any other
value.
If you see that it’s any other value, use Mark’s suggestion to print the
hex
value in the buffer. If you find that’s happening, you then need to
figure
out why it’s not what you expect.

The MSDN docs say that RtlFillMemory is preferred over RtlFillBytes, if
you
aren’t supporting Win9x.

Phil

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

“Mark Roddy” wrote in message news:xxxxx@ntdev…
> Neither of the values ‘1’ or ‘2’ are printable characters. Change %c
to
> %x.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Developer
>> Sent: Thursday, August 11, 2005 1:38 AM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] buffer(Albert’s question)
>>
>> members,
>>
>> of hand I have created a lot of confusion amongst you just
>> because of a stupid typo error, and trying to reproduce the
>> code by typing it.
>> well here is the original with the WinDbg output…
>>
>>
>> In global header the variable is declared as
>>
>> #define SIZEB 3000000
>> PCHAR buffer;
>>
>> in driver entry i allocate and initialize the buffer as
>>
>> buffer=ExAllocatePool( NonPagedPoolCacheAligned ,SIZEB);
>> RtlFillBytes(buffer,SIZEB,‘1’);
>>
>> In another function f00() that is called in some dispatcher, I write
>>
>>
>>
>> if(buffer[OFFSET]==‘2’){
>> KdPrint((“\nindex is : %u”,OFFSET));
>> KdPrint((“\n buffer[%u] is :
>> %c”,OFFSET,buffer[OFFSET]));
>> return 1;
>> }
>> else if(buffer[OFFSET]==‘1’){
>> KdPrint((\nindex is : %u",OFFSET));
>> KdPrint((“\n buffer[%u] is :
>> %c”,OFFSET,buffer[OFFSET]));
>> return 0;
>> }
>> }
>>
>>
>>
>>
>>
>> In the dispatcher for READ, I have…
>>
>> KdPrint((“\n(READ)”));
>> foo(OFFSET);
>>
>>
>>
>>
>> here is the dump from WinDbg.
>>
>> (READ)
>> index is : 955
>> buffer[955] is :
>>
>> (READ)
>> index is : 963
>> buffer[963] is :
>>
>>
>>
>> I am using debug (checked ) build and I am using WinDbg over
>> a serial cable conected at 19200 baud rate.
>>
>> I cannot get the reason why in the debugger I never see the
>> contents of the location OFFSET!!!
>>
>> -A


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

I always end the KdPrint strings with \r\n. Some older SoftICEs required
this.

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

----- Original Message -----
From: “Tim Roberts”
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 11, 2005 8:57 PM
Subject: Re: [ntdev] buffer(Albert’s question)

> Phil Barila wrote:
>
> >Jan Bottorff caught a likely cause of your problem. You are expecting
> >either ‘1’ or ‘2’, you need to catch the case where it is any other value.
> >
> >
>
> But if the value was other than ‘1’ or ‘2’, there wouldn’t be any prints
> at all. The fact that he is seeing KdPrints indicates that it must be
> matching one of those values.
>
> I wonder about his practice of including the \n at the beginning of the
> string, rather than the end. In a perfect world, it shouldn’t make any
> difference, but that would be one of the experiments I’d try, as well as
> the suggestion of printing the hex. There are differences in behavior
> between windbg, SoftIce, and dbmon when the newline is missing.
>
> >The MSDN docs say that RtlFillMemory is preferred over RtlFillBytes, if you
> >aren’t supporting Win9x.
> >
> >
>
> Well, that’s just a “wishful thinking” note. If you look in ntddk.h,
> you find:
> #define RtlFillBytes RtlFillMemory
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com