12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/def/windows/def_winspool.rb', line 12
def self.create_library(constant_manager, library_path = 'winspool.drv')
dll = Library.new(library_path, constant_manager)
dll.add_function('AddPrinterA', 'HANDLE',[
["PCHAR","pName","in"],
["DWORD","Level","in"],
["PBLOB","pPrinter","in"]
])
dll.add_function('AddPrinterW', 'HANDLE',[
["PWCHAR","pName","in"],
["DWORD","Level","in"],
["PBLOB","pPrinter","in"]
])
dll.add_function('EnumPrinterDriversA', 'BOOL',[
["PCHAR","pName","in"],
["PCHAR","pEnvironment","in"],
["DWORD","Level","in"],
["PBLOB","pDriverInfo","out"],
["DWORD","cbBuf","in"],
["PDWORD","pcbNeeded","out"],
["PDWORD","pcReturned","out"]
])
dll.add_function('EnumPrinterDriversW', 'BOOL',[
["PWCHAR","pName","in"],
["PWCHAR","pEnvironment","in"],
["DWORD","Level","in"],
["PBLOB","pDriverInfo","out"],
["DWORD","cbBuf","in"],
["PDWORD","pcbNeeded","out"],
["PDWORD","pcReturned","out"]
])
dll.add_function('EnumPrintersA', 'BOOL',[
["DWORD","Flags","in"],
["PCHAR","Name","in"],
["DWORD","Level","in"],
["PBLOB","pPrinterEnum","out"],
["DWORD","cbBuf","in"],
["PDWORD","pcbNeeded","out"],
["PDWORD","pcReturned","out"]
])
dll.add_function('EnumPrintersW', 'BOOL',[
["DWORD","Flags","in"],
["PWCHAR","Name","in"],
["DWORD","Level","in"],
["PBLOB","pPrinterEnum","out"],
["DWORD","cbBuf","in"],
["PDWORD","pcbNeeded","out"],
["PDWORD","pcReturned","out"]
])
dll.add_function('SetPrinterDataExA', 'DWORD',[
["HANDLE","hPrinter","in"],
["PCHAR","pKeyName","in"],
["PCHAR","pValueName","in"],
["DWORD","Type","in"],
["PBLOB","pData","in"],
["DWORD","cbData","in"]
])
dll.add_function('SetPrinterDataExW', 'DWORD',[
["HANDLE","hPrinter","in"],
["PWCHAR","pKeyName","in"],
["PWCHAR","pValueName","in"],
["DWORD","Type","in"],
["PBLOB","pData","in"],
["DWORD","cbData","in"]
])
dll.add_function('OpenPrinterA','BOOL',[
["PCHAR","pPrinterName","in"],
["PDWORD","phPrinter","out"],
["PBLOB","pDefault","in"]
])
dll.add_function('OpenPrinterW','BOOL',[
["PWCHAR","pPrinterName","in"],
["PDWORD","phPrinter","out"],
["PBLOB","pDefault","in"]
])
return dll
end
|