Seems like this does not compile as is. I believe it is an issue with the Cargo.toml file missing some enabled features for the winapi crate, but I have not been able to resolve. Hoping you could take a look. Below is the error from cargo-check:
cargo check
Checking safetydump v0.1.0 (/home/cryptic/Red Team/Rust/safetydump)
error[E0433]: failed to resolve: could not find shared
in winapi
--> src/lib.rs:6:5
|
6 | shared::{
| ^^^^^^ could not find shared
in winapi
error[E0433]: failed to resolve: could not find um
in winapi
--> src/lib.rs:22:5
|
22 | um::{
| ^^ could not find um
in winapi
error[E0433]: failed to resolve: could not find windows
in os
--> src/lib.rs:43:9
|
43 | os::windows::ffi::OsStrExt,
| ^^^^^^^ could not find windows
in os
error[E0432]: unresolved import winapi::ctypes
--> src/lib.rs:5:5
|
5 | ctypes::c_void,
| ^^^^^^ could not find ctypes
in winapi
error[E0412]: cannot find type HMODULE
in this scope
--> src/lib.rs:49:31
|
49 | fn get_dll(dll_name: &str) -> HMODULE {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function, tuple struct or tuple variant LoadLibraryW
in this scope
--> src/lib.rs:50:27
|
50 | let handle = unsafe { LoadLibraryW(get_wide(dll_name).as_ptr()) };
| ^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type HMODULE
in this scope
--> src/lib.rs:57:16
|
57 | fn get_fn(dll: HMODULE, fn_name: &str) -> FARPROC {
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:57:43
|
57 | fn get_fn(dll: HMODULE, fn_name: &str) -> FARPROC {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function, tuple struct or tuple variant GetProcAddress
in this scope
--> src/lib.rs:58:25
|
58 | let func = unsafe { GetProcAddress(dll, fn_name.as_ptr() as _) };
| ^^^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:66:48
|
66 | fn get_process_heap() -> Option<unsafe fn() -> HANDLE> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <HANDLE>
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:69:47
|
69 | Some(unsafe { std::mem::transmute(func as FARPROC) })
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:72:37
|
72 | fn heap_alloc() -> Option<unsafe fn(HANDLE, DWORD, SIZE_T) -> LPVOID> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <HANDLE>
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:72:45
|
72 | fn heap_alloc() -> Option<unsafe fn(HANDLE, DWORD, SIZE_T) -> LPVOID> {
| - ^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <DWORD>
error[E0412]: cannot find type SIZE_T
in this scope
--> src/lib.rs:72:52
|
72 | fn heap_alloc() -> Option<unsafe fn(HANDLE, DWORD, SIZE_T) -> LPVOID> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <SIZE_T>
error[E0412]: cannot find type LPVOID
in this scope
--> src/lib.rs:72:63
|
72 | fn heap_alloc() -> Option<unsafe fn(HANDLE, DWORD, SIZE_T) -> LPVOID> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <LPVOID>
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:75:47
|
75 | Some(unsafe { std::mem::transmute(func as FARPROC) })
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:78:39
|
78 | fn heap_realloc() -> Option<unsafe fn(HANDLE, DWORD, LPVOID, SIZE_T) -> LPVOID> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <HANDLE>
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:78:47
|
78 | fn heap_realloc() -> Option<unsafe fn(HANDLE, DWORD, LPVOID, SIZE_T) -> LPVOID> {
| - ^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <DWORD>
error[E0412]: cannot find type LPVOID
in this scope
--> src/lib.rs:78:54
|
78 | fn heap_realloc() -> Option<unsafe fn(HANDLE, DWORD, LPVOID, SIZE_T) -> LPVOID> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <LPVOID>
error[E0412]: cannot find type SIZE_T
in this scope
--> src/lib.rs:78:62
|
78 | fn heap_realloc() -> Option<unsafe fn(HANDLE, DWORD, LPVOID, SIZE_T) -> LPVOID> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <SIZE_T>
error[E0412]: cannot find type LPVOID
in this scope
--> src/lib.rs:78:73
|
78 | fn heap_realloc() -> Option<unsafe fn(HANDLE, DWORD, LPVOID, SIZE_T) -> LPVOID> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <LPVOID>
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:81:47
|
81 | Some(unsafe { std::mem::transmute(func as FARPROC) })
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:84:36
|
84 | fn heap_free() -> Option<unsafe fn(HANDLE, DWORD, LPVOID) -> bool> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <HANDLE>
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:84:44
|
84 | fn heap_free() -> Option<unsafe fn(HANDLE, DWORD, LPVOID) -> bool> {
| - ^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <DWORD>
error[E0412]: cannot find type LPVOID
in this scope
--> src/lib.rs:84:51
|
84 | fn heap_free() -> Option<unsafe fn(HANDLE, DWORD, LPVOID) -> bool> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <LPVOID>
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:87:47
|
87 | Some(unsafe { std::mem::transmute(func as FARPROC) })
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:90:36
|
90 | fn heap_size() -> Option<unsafe fn(HANDLE, DWORD, LPCVOID) -> SIZE_T> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <HANDLE>
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:90:44
|
90 | fn heap_size() -> Option<unsafe fn(HANDLE, DWORD, LPCVOID) -> SIZE_T> {
| - ^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <DWORD>
error[E0412]: cannot find type LPCVOID
in this scope
--> src/lib.rs:90:51
|
90 | fn heap_size() -> Option<unsafe fn(HANDLE, DWORD, LPCVOID) -> SIZE_T> {
| - ^^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <LPCVOID>
error[E0412]: cannot find type SIZE_T
in this scope
--> src/lib.rs:90:63
|
90 | fn heap_size() -> Option<unsafe fn(HANDLE, DWORD, LPCVOID) -> SIZE_T> {
| - ^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: <SIZE_T>
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:93:47
|
93 | Some(unsafe { std::mem::transmute(func as FARPROC) })
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HRESULT
in this scope
--> src/lib.rs:130:13
|
130 | status: HRESULT
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:210:10
|
210 | ) -> HANDLE = unsafe { std::mem::transmute(gcp_func as FARPROC) };
| ^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:210:60
|
210 | ) -> HANDLE = unsafe { std::mem::transmute(gcp_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:213:9
|
213 | HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:214:9
|
214 | DWORD,
| ^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:215:14
|
215 | *mut HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:216:58
|
216 | ) -> bool = unsafe { std::mem::transmute(opt_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type LPCWSTR
in this scope
--> src/lib.rs:219:9
|
219 | LPCWSTR,
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type LPCWSTR
in this scope
--> src/lib.rs:220:9
|
220 | LPCWSTR,
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type LUID
in this scope
--> src/lib.rs:221:14
|
221 | *mut LUID,
| ^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:222:59
|
222 | ) -> bool = unsafe { std::mem::transmute(lpvw_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:225:9
|
225 | HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type BOOL
in this scope
--> src/lib.rs:226:9
|
226 | BOOL,
| ^^^^ help: a builtin type with a similar name exists: bool
error[E0412]: cannot find type PTOKEN_PRIVILEGES
in this scope
--> src/lib.rs:227:9
|
227 | PTOKEN_PRIVILEGES,
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:228:9
|
228 | DWORD,
| ^^^^^ not found in this scope
error[E0412]: cannot find type PTOKEN_PRIVILEGES
in this scope
--> src/lib.rs:229:9
|
229 | PTOKEN_PRIVILEGES,
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type PDWORD
in this scope
--> src/lib.rs:230:9
|
230 | PDWORD,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:231:58
|
231 | ) -> bool = unsafe { std::mem::transmute(atp_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:234:10
|
234 | ) -> DWORD = unsafe { std::mem::transmute(gle_func as FARPROC) };
| ^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:234:59
|
234 | ) -> DWORD = unsafe { std::mem::transmute(gle_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:237:9
|
237 | HANDLE
| ^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:238:57
|
238 | ) -> bool = unsafe { std::mem::transmute(ch_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:241:22
|
241 | let mut h_token: HANDLE = 0 as _;
| ^^^^^^ not found in this scope
error[E0425]: cannot find value TOKEN_ADJUST_PRIVILEGES
in this scope
--> src/lib.rs:244:9
|
244 | TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
| ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value TOKEN_QUERY
in this scope
--> src/lib.rs:244:35
|
244 | TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
| ^^^^^^^^^^^ not found in this scope
error[E0422]: cannot find struct, variant or union type LUID_AND_ATTRIBUTES
in this scope
--> src/lib.rs:249:17
|
249 | let privs = LUID_AND_ATTRIBUTES {
| ^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0422]: cannot find struct, variant or union type LUID
in this scope
--> src/lib.rs:250:15
|
250 | Luid: LUID {
| ^^^^ not found in this scope
error[E0425]: cannot find value SE_PRIVILEGE_ENABLED
in this scope
--> src/lib.rs:254:21
|
254 | Attributes: SE_PRIVILEGE_ENABLED,
| ^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0422]: cannot find struct, variant or union type TOKEN_PRIVILEGES
in this scope
--> src/lib.rs:256:18
|
256 | let mut tp = TOKEN_PRIVILEGES {
| ^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value SE_DEBUG_NAME
in this scope
--> src/lib.rs:262:18
|
262 | get_wide(SE_DEBUG_NAME).as_mut_ptr(),
| ^^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type TOKEN_PRIVILEGES
in this scope
--> src/lib.rs:272:19
|
197 | fn enable_sedebug() -> bool {
| - help: you might be missing a type parameter: <TOKEN_PRIVILEGES>
...
272 | size_of::<TOKEN_PRIVILEGES>() as _,
| ^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value ERROR_NOT_ALL_ASSIGNED
in this scope
--> src/lib.rs:278:36
|
278 | if unsafe{ GetLastError() } == ERROR_NOT_ALL_ASSIGNED {
| ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value S_FALSE
in this scope
--> src/lib.rs:289:37
|
289 | callbackOutput.status = S_FALSE;
| ^^^^^^^ not found in this scope
error[E0425]: cannot find value S_OK
in this scope
--> src/lib.rs:293:37
|
293 | callbackOutput.status = S_OK;
| ^^^^ not found in this scope
error[E0412]: cannot find type DWORD_PTR
in this scope
--> src/lib.rs:322:40
|
322 | let destination = (*buf as DWORD_PTR + callbackInput.io.offset as DWORD_PTR) as LPVOID;
| ^^^^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD_PTR
in this scope
--> src/lib.rs:322:79
|
322 | let destination = (*buf as DWORD_PTR + callbackInput.io.offset as DWORD_PTR) as LPVOID;
| ^^^^^^^^^ not found in this scope
error[E0412]: cannot find type LPVOID
in this scope
--> src/lib.rs:322:93
|
322 | let destination = (*buf as DWORD_PTR + callbackInput.io.offset as DWORD_PTR) as LPVOID;
| ^^^^^^ not found in this scope
error[E0425]: cannot find function, tuple struct or tuple variant RtlCopyMemory
in this scope
--> src/lib.rs:324:17
|
324 | RtlCopyMemory(
| ^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value S_OK
in this scope
--> src/lib.rs:333:37
|
333 | callbackOutput.status = S_OK;
| ^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:367:9
|
367 | HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:368:9
|
368 | DWORD,
| ^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:369:9
|
369 | HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:374:59
|
374 | ) -> bool = unsafe { std::mem::transmute(mdwd_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HMODULE
in this scope
--> src/lib.rs:377:9
|
377 | HMODULE,
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:378:62
|
378 | ) -> bool = unsafe { std::mem::transmute(freelib_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:381:9
|
381 | HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type ACCESS_MASK
in this scope
--> src/lib.rs:382:9
|
382 | ACCESS_MASK,
| ^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:385:14
|
385 | *mut HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type NTSTATUS
in this scope
--> src/lib.rs:386:10
|
386 | ) -> NTSTATUS = unsafe { std::mem::transmute(getnext_func as FARPROC) };
| ^^^^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:386:66
|
386 | ) -> NTSTATUS = unsafe { std::mem::transmute(getnext_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:389:9
|
389 | HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type HMODULE
in this scope
--> src/lib.rs:390:9
|
390 | HMODULE,
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:392:9
|
392 | DWORD,
| ^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:393:10
|
393 | ) -> DWORD = unsafe { std::mem::transmute(getfilename_func as FARPROC) };
| ^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:393:67
|
393 | ) -> DWORD = unsafe { std::mem::transmute(getfilename_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:396:9
|
396 | HANDLE
| ^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:397:10
|
397 | ) -> DWORD = unsafe { std::mem::transmute(getpid_func as FARPROC) };
| ^^^^^ not found in this scope
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:397:62
|
397 | ) -> DWORD = unsafe { std::mem::transmute(getpid_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:400:9
|
400 | HANDLE,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type PPROCESS_MEMORY_COUNTERS
in this scope
--> src/lib.rs:401:9
|
401 | PPROCESS_MEMORY_COUNTERS,
| ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:402:9
|
402 | DWORD,
| ^^^^^ not found in this scope
error[E0412]: cannot find type BOOL
in this scope
--> src/lib.rs:403:10
|
403 | ) -> BOOL = unsafe { std::mem::transmute(getmeminfo_func as FARPROC) };
| ^^^^ help: a builtin type with a similar name exists: bool
error[E0412]: cannot find type FARPROC
in this scope
--> src/lib.rs:403:65
|
403 | ) -> BOOL = unsafe { std::mem::transmute(getmeminfo_func as FARPROC) };
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type HANDLE
in this scope
--> src/lib.rs:406:21
|
406 | let mut handle: HANDLE = 0 as _;
| ^^^^^^ not found in this scope
error[E0425]: cannot find value MAXIMUM_ALLOWED
in this scope
--> src/lib.rs:410:9
|
410 | MAXIMUM_ALLOWED,
| ^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value MAX_PATH
in this scope
--> src/lib.rs:415:27
|
415 | let mut buf = [0; MAX_PATH];
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find value MAX_PATH
in this scope
--> src/lib.rs:420:13
|
420 | MAX_PATH as _,
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find value MAX_PATH
in this scope
--> src/lib.rs:422:55
|
422 | let buf_str = String::from_utf16_lossy(&buf[..MAX_PATH]);
| ^^^^^^^^ not found in this scope
error[E0412]: cannot find type PROCESS_MEMORY_COUNTERS
in this scope
--> src/lib.rs:447:33
|
342 | pub fn in_memory_dump(args: Vec<&str>) -> String {
| - help: you might be missing a type parameter: <PROCESS_MEMORY_COUNTERS>
...
447 | let mut pmc = MaybeUninit::<PROCESS_MEMORY_COUNTERS>::uninit();
| ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type DWORD
in this scope
--> src/lib.rs:451:30
|
451 | size_of_val(&pmc) as DWORD
| ^^^^^ not found in this scope
error[E0425]: cannot find value HEAP_ZERO_MEMORY
in this scope
--> src/lib.rs:465:9
|
465 | HEAP_ZERO_MEMORY,
| ^^^^^^^^^^^^^^^^ not found in this scope
error[E0599]: no method named encode_wide
found for reference &OsStr
in the current scope
--> src/lib.rs:194:19
|
194 | OsStr::new(s).encode_wide().chain(std::iter::once(0)).collect()
| ^^^^^^^^^^^ method not found in &OsStr
Some errors have detailed explanations: E0412, E0422, E0425, E0432, E0433, E0599.
For more information about an error, try rustc --explain E0412
.
error: could not compile safetydump
due to 103 previous errors