http://support.microsoft.com/support/kb/articles/Q178/3/17.asp
http:
-Eliyas
http://support.microsoft.com/support/ddk/
http:</http:>
-----Original Message-----
From: Roddy, Mark
Sent: Tue 12/19/2000 11:18 AM
To: NT Developers Interest List
Cc:
Subject: [ntdev] RE: copying data from kernel mode to user mode
Barak,
>
> I have some follow-up questions:
> When I copy my buffer to the user, may I use memcpy()?
>
No not legally. You should use RtlCopyMemory.
>
> I changed the code, to copy data to the
> Irp->AssociatedIrp.SystemBuffer
> field, but then I always get a blue screen (exception not handled).
>
> I did a try- catch around it, ( catch(0) ), but I still get the
> “exception unhandled” blue screen.
>
Well something is obviously wrong.
My earlier posting, on reflection, was less than crystal clear about the
exception handling. METHOD_BUFFERED never needs an exception handler, only
METHOD_NEITHER needs to use this technique. BTW, you can’t use try/catch you
have to use try/except, and the syntax is:
try
{
}
except(EXCEPTION_EXECUTE_HANDLER)
{
}
for C++ code or try {} except(EXCEPTION_EXECUTE_HANDLER){} for C code.
> When I copy the data to Irp->UserBuffer – it works fine.
>
> What am I doing wrong?
I have no idea, given that I can’t see your code. One guess is that you have
not specified an ‘output buffer’ in your invocation of DeviceControl from
user space, or you specified a length that is way too small.
> Can I be sure that the Irp->AssociatedIrp.SystemBuffer area is
> at the size of the user’s buffer? How can I get the size of this
> buffer from the IRP?
You have to look at the IoStack parameters for the IOCTL to see how big the
output buffer is. My guess is that it is zero length. Read about
IoGetCurrentIrpStackLocation().
>
> As you can see, these are all newbie’s questions… I think
> that there’s something here I just don’t get… ;-(
>
The DDK has lots of source examples one or more of which most likely
actually processes a METHOD_BUFFERED IOCTL with an output buffer. Search the
sample drivers for something that does what you are trying to do.
> One more things: The chapter numbers that you specified in your
> previous message - to which DDK do they apply? the win2k DDK?
> (Currently, only the NT4 DDK is installed on my machine )
>
W2K of course, get with the program
Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
WindowsNT Windows 2000 Consulting Services
—
You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
begin 600 winmail.dat
M>)^(BD50:0"``$```````!``$``0>0!@
(Y`0```````#H``$%@`,`<br>M#@```-`'#``3``P`(``9``(`/0$!"8`!`"$
S,#0T-3=“0T0U0T4X,C1#
M0C!&035”,C-“.$(Q,$%”-P!!P$@@,
#@-`'#``3``T`(``F``(`2P$!<br>M#8`$``(````"``(``0.0!@"<&
.@$``.0`3S`W,^FG``1\`,4`!````<br>M#@
#,-0
U#,
.0P```````#
!I!\`,$`!````#@```#,`-0`U<br>M`#,`.0`P```````#`!E
!`20!````;@```%L
;@!T&0
90!V%T
M(!2
$4.@
@&,
;P!P'D
:0!N&<
(!D
&$=
!A"``9@!R
&`;0@<br>M
&L90!R
&X90!L
";0!O`&0`90`@`'0`;P`@`'4`<p>M9`!E``````!
$X@$xxxxx@O!IP
$“5L``0```$``````````@2L?I+ZC$!F=<br>M;@#=
0]4@````!2;V1D>2P@36%R:P!33510
$UAMM'(
:P!?%(
;P!D&0
>0!',`=`!R`&$`=`!U`',`+@!C`&\`;0``````<br>M'P!:
$8
4@!O&0
9!Y
"P(
!-&$
<@!K'P`R0`$
N
M30!A`'(`:P!?`%(`;P!D`&0`>0!``',`=`!R`&$`=`!U`',`+@!C`&\`<br>M;0```````@%<``$
<4TU44#I-05)+7U)/1$190%-44D%455,N0T]-<br>M``,`'4```````@%>``$```!``````````($K'Z2^HQ`9G6X`W0$/5`(`````<br>M4F]D9'DL($UA<fl>M
”@%,`30!4`%```````!\`:0`!````+@
$T80!R
&L7P!2
&`
M9!D
’D0
!S'0
<@!A'0
=0!S"X
8P!O&T``````!\
70!````&```<br>M
%(;P!D
&0>0
L"``30!A
’(:P```!\
,T!````+@```$T
80!R&L
M7P!2&\
9!D
’D0
!S'0
<@!A'0
=0!S"X
8P!O&T```````(!7P
!
M'
%–5%Z34%22U]23T1$64!35%)!5%53+D-/30
#!Y```````(!<br>M<0
!&P
’:?-,\IH14,?PO42DB^;R@[E(CO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=Q3+A#O$?\3#_O*!G
9&E!W<^D&-8@<br>M,C#_&A
KPN_>Y4TH4?0&N"<M)PD#R4?NVA/DT-CY]9'P>\
8$[T>@>6#&L33
9#10&D;7R=[EM"1LQ!I
M>:T0>4#N;31P>(!.(&:@M(&%IOY.PW/\M?WMW/-!K\2TL,^M-S-(0!4R=L"RH%^\L#!_,8\RGSI,-3LQ<br>M+_Q&3^D
.XGU)R/@]38VXI_:#R(-M,\CS9&-S(^0390.XZ3#
<@#Y00DR!
M;N!+455/5$4^OSU"WV<_\3;2&\VT5RNE!91%U$$GO3'$WH3Y!2%1-<br>M3#N
?4Z@!\
1Q!````'@```&T
90!S',
80!G&4
+P!R&8
8PX
#(<br>M,@```````P
F```````##8```````,
WC_I_0```P#Q/PD$```#/T_Y
0<br>M
!`<!````;@```%L`;@!T`&0`90!V`%T`(`!2`$4`.@`@`&,`;P!P`'D`<br>M:0!N`&<`(`!D`&$`=`!A`"
9@!R`&`;0`@`&L`90!R`&X`90!L`“;0!O<br>M`&0`90`@`'0`;P`@`'4`<p>M]!``````"P#U$``````+`/80`````!\`\Q`!````A@```%(`10`E`#,`00`@<br>M`%L`;@!T`&0`90!V`%T`(`!2`$4`)0`S`$$`(`!C`&\`<`!Y`&D`;@!G`"
M9`!A`'0`80`@`&8`<@!O`&T`(`!K`&4`<@!N`&4`;@`&T`;P!D`&4`(`!T<br>M`&\`(`!U`',`90!R`"
;0!O`&0`90`N`$4`30!,```````”`4<0```#(`<br>M
!C/553.V$]34-).W`];7-F=#ML/5)%1"U-4TM6BTS-30X`````@'Y/P$```!1`````````-RG0,C`0A`:M+D(`“LOX8(!````
M`````”]//4U)0U)/4T]&5"]/53U.3U)42$%-15))0T$O0TX]4D5#25!)14Y4
M4R]#3CTS-34S.3``````‘P#X/P$````:````10!L`&D`>0!A`’,`(`!9`&$`
M:P!U`&(``````!`.$`!````#@```#,`-0`U`#,`.0`P```````"`?L`0<br>M`%$`````````W*=`R,!"$!JTN0@`*R_A@@$`````````+T\]34E#4D]33T94<br>M+T]5/4Y/4E1(04U%4DE#02]#3CU214-)4$E%3E13+T-./3,U-3,Y,``````?<br>M`/H_`0```!H```!%`&P`:0!Y`&$`<p>M```.````,P`U`#4`,P`Y`#```````$
!S"4-6:^FG4
"#!$U,U`VK`
M`1`&@`!````$@```$D`4`!-`“X`3@!/`%0`10``````‘P`W$```!V````<br>M4@!%`#H`(`!;`&X`=`!D`&4`=@!=`"
4@!%`#H`(`!C`&`<`!Y`&D`;@!G
M`"9`!A`'0`80`@`&8`<@!O`&T`(`!K`&4`<@!N`&4`;
@`&T`;P!D`&4`
M(`!T`&`(`!U`’,`90!R`”;0!O`&0`90``````'P`]
$````*````4@!%
M`#H`(```````'P`=#@$```!N````6P!N`'0`9`!E`'8`70`@`%(`10`Z`”<br>M8P!O`'
>0!I`&X`9P`@`&0`80!T`&$`(`!F`‘(`;P!M`“:P!E`'(`;@!E<br>M`&P`(`!M`&\`9`!E`"
=`!O`”=0!S`&4`<@`@`&T`;P!D`&4``````!\`<br>M-1`!````G@```#P`,
Q`#(`10`T`$0`.S`#4`-
Y`#$`00`R`#0`.Y<br>M`$(`0@`S`$(`.0!!`$0`-P!&`#
.V`$8`1@`R`#0`.
X`#4`.`!%`$<br>M<@!E`&0`+0!M`',`9P`M`#
-0`N`’(`90!D`&T`;P!N`&0`+@!C`&`<@!P
M`"X`;0!I`&,`<@!O`',`;P!F`'0`+@!C`&`;0`^```````+`"D```````L`
M(P```````P`&$/*T"<#<02P@```,`$!```````P`1$``````>
@0`0<br>M`&4```!(5%10.B\O4U504$]25$U)0U)/4T]&5$-/32]355!03U)4+TM"+T%2<br>M5$E#3$53+U$xxxxx@O,R\Q-T%34#Q(5%10.B\O4U504$]25$U)0U)/4T]&5$-/<br>M32]355!03U)4+TM"+T%2``````(!?P`!````3P```#PP,3)%-$0X,S4T.3%!<br>M,C0X.4)",T(Y040W1C`X-D9&,C0X.#4X14!R960M;7-G+3`U+G)E9&UO;F0N<br>78V]R<"YM:6-R;W-O9G0N8V]M/@
;U@=
`
end
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
</t.>
</http:>