@@ -8,7 +8,7 @@ function LoadApi
8
8
{
9
9
# already loaded
10
10
return ;
11
- }
11
+ }
12
12
13
13
$code = @'
14
14
using System;
@@ -21,7 +21,7 @@ namespace PowerDump
21
21
public class Native
22
22
{
23
23
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
24
- public static extern int RegOpenKeyEx(
24
+ public static extern int RegOpenKeyEx(
25
25
int hKey,
26
26
string subKey,
27
27
int ulOptions,
@@ -73,16 +73,16 @@ namespace PowerDump
73
73
}
74
74
'@
75
75
76
- $provider = New-Object Microsoft.CSharp.CSharpCodeProvider
77
- $dllName = [PsObject ].Assembly.Location
78
- $compilerParameters = New-Object System.CodeDom.Compiler.CompilerParameters
79
- $assemblies = @ (" System.dll" , $dllName )
80
- $compilerParameters.ReferencedAssemblies.AddRange ($assemblies )
81
- $compilerParameters.GenerateInMemory = $true
82
- $compilerResults = $provider.CompileAssemblyFromSource ($compilerParameters , $code )
83
- if ($compilerResults.Errors.Count -gt 0 ) {
84
- $compilerResults.Errors | % { Write-Error (" {0}:`t {1}" -f $_.Line , $_.ErrorText ) }
85
- }
76
+ $provider = New-Object Microsoft.CSharp.CSharpCodeProvider
77
+ $dllName = [PsObject ].Assembly.Location
78
+ $compilerParameters = New-Object System.CodeDom.Compiler.CompilerParameters
79
+ $assemblies = @ (" System.dll" , $dllName )
80
+ $compilerParameters.ReferencedAssemblies.AddRange ($assemblies )
81
+ $compilerParameters.GenerateInMemory = $true
82
+ $compilerResults = $provider.CompileAssemblyFromSource ($compilerParameters , $code )
83
+ if ($compilerResults.Errors.Count -gt 0 ) {
84
+ $compilerResults.Errors | % { Write-Error (" {0}:`t {1}" -f $_.Line , $_.ErrorText ) }
85
+ }
86
86
87
87
}
88
88
@@ -218,22 +218,22 @@ function Get-RegKeyClass([string]$key, [string]$subkey)
218
218
[int ]$hkey = 0
219
219
if (-not [PowerDump.Native ]::RegOpenKeyEx($nkey , $subkey , 0 , $KEYREAD , [ref ]$hkey ))
220
220
{
221
- $classVal = New-Object Text.Stringbuilder 1024
222
- [int ]$len = 1024
223
- if (-not [PowerDump.Native ]::RegQueryInfoKey($hkey , $classVal , [ref ]$len , 0 , [ref ]$null , [ref ]$null ,
224
- [ref ]$null , [ref ]$null , [ref ]$null , [ref ]$null , [ref ]$null , 0 ))
225
- {
226
- $result = $classVal.ToString ()
227
- }
228
- else
229
- {
230
- Write-Error " RegQueryInfoKey failed" ;
231
- }
232
- [PowerDump.Native ]::RegCloseKey($hkey ) | Out-Null
221
+ $classVal = New-Object Text.Stringbuilder 1024
222
+ [int ]$len = 1024
223
+ if (-not [PowerDump.Native ]::RegQueryInfoKey($hkey , $classVal , [ref ]$len , 0 , [ref ]$null , [ref ]$null ,
224
+ [ref ]$null , [ref ]$null , [ref ]$null , [ref ]$null , [ref ]$null , 0 ))
225
+ {
226
+ $result = $classVal.ToString ()
227
+ }
228
+ else
229
+ {
230
+ Write-Error " RegQueryInfoKey failed" ;
231
+ }
232
+ [PowerDump.Native ]::RegCloseKey($hkey ) | Out-Null
233
233
}
234
234
else
235
235
{
236
- Write-Error " Cannot open key" ;
236
+ Write-Error " Cannot open key" ;
237
237
}
238
238
return $result ;
239
239
}
0 commit comments