windowskernelprogrammingbook2e icon indicating copy to clipboard operation
windowskernelprogrammingbook2e copied to clipboard

code neatpick: ExAllocatePoolWithTag deprecated, page 44

Open profnandaa opened this issue 2 years ago • 5 comments

image

  1. UNREFERENCED_PARAMETER not needed since DriverObject is referenced?
  2. Did we need to cast RegistryPath since it was already PUNICODE_STRING from the DriverEntry function definition?
  3. Lastly I get warning that ExAllocatePoolWithTag is deprecated:

Warning C4996 'ExAllocatePoolWithTag': ExAllocatePoolWithTag is deprecated, use ExAllocatePool2.

This might require update of table 3-4 too on page 42:

image

== Developing on Windows 11.

profnandaa avatar Apr 25 '23 09:04 profnandaa

Yes, I need to fix the table of functions. The cast is needed, since it's a pointer to a const UNICODE_STRING The UNREFERENCED_PARAMETER is not needed, but it doesn't hurt, either.

zodiacon avatar Apr 25 '23 11:04 zodiacon

Oh, I missed the C in PCUNICODE, my bad.

./na

On Tue, Apr 25, 2023, 14:27 Pavel Yosifovich @.***> wrote:

Yes, I need to fix the table of functions. The cast is needed, since it's a pointer to a const UNICODE_STRING The UNREFERENCED_PARAMETER is not needed, but it doesn't hurt, either.

— Reply to this email directly, view it on GitHub https://github.com/zodiacon/windowskernelprogrammingbook2e/issues/7#issuecomment-1521628158, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB7ZEIGJERSUZ7DAAPR223XC6YJTANCNFSM6AAAAAAXKYHQ7Q . You are receiving this because you authored the thread.Message ID: @.***>

profnandaa avatar Apr 25 '23 13:04 profnandaa

While at it, remember to also update the ExAllocatePool2 argument from PagedPool to POOL_FLAG_PAGED since they are different enums. Took me some time before noticing since I kept getting insufficient resource error.

PS> sc.exe start SampleMem
[SC] StartService FAILED 1450:

Insufficient system resources exist to complete the requested service.

Wish they could have made it fully backward compatible with ExAllocatePoolWithTag interface wise.

profnandaa avatar Apr 26 '23 10:04 profnandaa

While at it, you can also update the ExAllocatePoolWithTagPriority to ExAllocatePool3 in pg. 226.

image

profnandaa avatar Jun 07 '23 07:06 profnandaa

While at it, you can also update the ExAllocatePoolWithTagPriority to ExAllocatePool3 in pg. 226.

image

RE: previous comment PS. Since you've explained in pgs 228-229, I think, just a side note will be enough. Thanks!

profnandaa avatar Jun 07 '23 07:06 profnandaa