Skip to content

Commit 6d6c78a

Browse files
committed
Add scripts for parsing the ntstatus.h file, and the WM messages listed in http://blog.airesoft.co.uk/2009/11/wm_messages/
1 parent d71ffbd commit 6d6c78a

File tree

3 files changed

+1078
-0
lines changed

3 files changed

+1078
-0
lines changed

Scripts/ntstatus.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
clear-host
2+
$Start = "<?xml version=""1.0"" ?>`r`n<NtstatusList>`r`n"
3+
$End = '</NtstatusList>'
4+
# XML formatting
5+
$Pre = "`t<Ntstatus text="""
6+
$Mid = """ value="""
7+
$Post = """ />`r`n"
8+
9+
# Paths and the regex
10+
$ParentFolder = Join-Path $MyInvocation.MyCommand.Path ".."
11+
$OutputFile = "$ParentFolder\..\GUI\Resources\ntstatus.xml"
12+
$regex = '^#define\s(\w[A-Z_0-9]+)\s+\(\(NTSTATUS\)0x(\w[0-9A-F]+)L\)'
13+
$Run = $false
14+
15+
# Loop through all the lines in the header file and match against the regex
16+
# Add any matches to our output using the XML formatting
17+
$Output = $Start
18+
foreach($line in (Get-Content "c:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\shared\ntstatus.h")) {
19+
if ($line -match $regex) {
20+
# Don't start to write until we hit the STATUS_SUCCESS define
21+
if ($Run -eq $false -and ($matches[1] -eq 'STATUS_SUCCESS')) {
22+
$Run = $true;
23+
}
24+
25+
if ($Run -eq $true) {
26+
$output += $Pre + $matches[1] + $Mid + $matches[2] + $Post
27+
}
28+
}
29+
}
30+
$Output += $End
31+
$Output | Out-File $OutputFile

Scripts/wm.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# WM message list - http://blog.airesoft.co.uk/2009/11/wm_messages/
2+
3+
clear-host
4+
$Start = "<?xml version=""1.0"" ?>`r`n<WindowMessageList>`r`n"
5+
$End = '</WindowMessageList>'
6+
$Pre = "`t<WindowMessage text="""
7+
$Mid = """ value="""
8+
$Post = """ />`r`n"
9+
10+
$ParentFolder = Join-Path $MyInvocation.MyCommand.Path ".."
11+
$OutputFile = "$ParentFolder\..\GUI\Resources\wm.xml"
12+
13+
$Output = $Start
14+
foreach($line in (Get-Content $ParentFolder\wm_messages.txt)){
15+
16+
$nline = $line.Split(" ")
17+
$decimal = [Convert]::ToInt64($nline[2],16)
18+
$output += $Pre + $nline[1] + $Mid + $decimal + $Post
19+
}
20+
$Output += $End
21+
$Output | Out-File $OutputFile

0 commit comments

Comments
 (0)