Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Windbg script fails at alias expansion

Raja_KannanRaja_Kannan Member Posts: 1
The below windbg script always fails. I couldn't figure out what I am doing wrong.
==============================================================
$$
$$ print all imported function names. ${$arg1} base address of a loaded image
$$

.block {
.expr /s c++
r $t1 = ${$arg1} + ((ntdll32!_IMAGE_DOS_HEADER*)${$arg1})->e_lfanew
r $t1 = ${$arg1} + ((ntdll32!_IMAGE_NT_HEADERS*)@$t1)->OptionalHeader.DataDirectory[1].VirtualAddress
r $t0 = 0

aS ${curImpDesc} ((Mydll_00!_IMAGE_IMPORT_DESCRIPTOR*)@$t1)[@$t0]
.while (${curImpDesc}.Name != 0) {
.printf "\n Imported Image: %ma\n", (${$arg1} + ${curImpDesc}.Name)

r $t2 = 0
r $t3 = ${$arg1} + ${curImpDesc}.OriginalFirstThunk

aS ${curThunkData} ((Mydll_00!_IMAGE_THUNK_DATA32*)@$t3)[@$t2]
.while (${curThunkData}.u1.AddressOfData != 0) {
r $t4 = ${$arg1} + ${curThunkData}.u1.AddressOfData
da &(((Mydll_00!_IMAGE_IMPORT_BY_NAME*)@$t4)->Name)
r $t2 = @$t2 + 1
}
r $t0 = @$t0 + 1
}

ad ${curImpDesc}
ad ${curThunkData}
}

==========================================================

I wrote this script to print the imported image name , followed by all the imported function names. If I run this script line-by-line all going fine and I get the expected output. But if I run it as script file, then I am getting error

0:065:x86> $$>a< "D:\import.wds" 0x74e70000
Unexpected character in '${curImpDesc}.Name != 0) {;....

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 30 Nov 2020 LIVE ONLINE
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Developing Minifilters Early 2021 LIVE ONLINE