diff --git a/electron/index.js b/electron/index.js index e583f42f26e0032d1ad6d7a5cee761442283282c..b6fb2cff691c3dd05adee7690081abad22e208bb 100644 --- a/electron/index.js +++ b/electron/index.js @@ -1,22 +1,36 @@ +// https://github.com/wwog/easyWin + import ffi from 'ffi-napi' -// var libm = ffi.Library('libm', { -// 'ceil': [ 'double', [ 'double' ] ] -// }); -// libm.ceil(1.5); // 2 +import hmc from 'hmc-win32'; -// You can also access just functions in the current process by passing a null -// var current = ffi.Library(null, { -// 'atoi': [ 'int', [ 'string' ] ] -// }); -// current.atoi('1234'); // 1234 +function 测试ffi_napi() { + // var libm = ffi.Library('libm', { + // 'ceil': [ 'double', [ 'double' ] ] + // }); + // libm.ceil(1.5); // 2 + + // You can also access just functions in the current process by passing a null + // var current = ffi.Library(null, { + // 'atoi': [ 'int', [ 'string' ] ] + // }); + // current.atoi('1234'); // 1234 + + var current = ffi.Library('user32.dll', { + 'MessageBoxA': [ 'int', [ 'int', 'int' , 'int' , 'int' ] ] + }); + current.MessageBoxA(0,0,0,0); // 1234 + + // NTSTATUS NTAPI NtSuspendProcess(HANDLE ProcessHandle) + var ntdll = ffi.Library('ntdll.dll', { + 'NtSuspendProcess': [ 'int', [ 'int' ] ] + }); + ntdll.NtSuspendProcess(-1); +} -var current = ffi.Library('user32.dll', { - 'MessageBoxA': [ 'int', [ 'int', 'int' , 'int' , 'int' ] ] -}); -current.MessageBoxA(0,0,0,0); // 1234 +function 测试hmc() { + // console.log(hmc) + let procList = hmc.Process.getDetailsList() + console.log(procList) +} -// NTSTATUS NTAPI NtSuspendProcess(HANDLE ProcessHandle) -var ntdll = ffi.Library('ntdll.dll', { - 'NtSuspendProcess': [ 'int', [ 'int' ] ] -}); -ntdll.NtSuspendProcess(-1); +测试hmc() \ No newline at end of file diff --git a/electron/package-lock.json b/electron/package-lock.json index 0187ca41a91b774afca6837d80abcf3dc8e6339b..599baa662c609f553bd3055dc85967de7f3451ee 100644 --- a/electron/package-lock.json +++ b/electron/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "ffi-napi": "^4.0.3", + "hmc-win32": "^1.3.9", "win32-api": "^20.4.1" } }, @@ -70,6 +71,14 @@ "get-symbol-from-current-process-h": "^1.0.1" } }, + "node_modules/hmc-win32": { + "version": "1.3.9", + "resolved": "https://registry.npmmirror.com/hmc-win32/-/hmc-win32-1.3.9.tgz", + "integrity": "sha512-FyhWEQRhO0ruUNSoZAQob3BTxdw/7ALjrA3mAt0SmjjXYIedbftUTX7qGCqHspFsthYjA1YM171KX9lDIWbyPA==", + "engines": { + "node": ">= 6.14.2" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz", @@ -227,6 +236,11 @@ "get-symbol-from-current-process-h": "^1.0.1" } }, + "hmc-win32": { + "version": "1.3.9", + "resolved": "https://registry.npmmirror.com/hmc-win32/-/hmc-win32-1.3.9.tgz", + "integrity": "sha512-FyhWEQRhO0ruUNSoZAQob3BTxdw/7ALjrA3mAt0SmjjXYIedbftUTX7qGCqHspFsthYjA1YM171KX9lDIWbyPA==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz", diff --git a/electron/package.json b/electron/package.json index d300a41d5c798a6079a61598cf5822c72815bb60..8e4951854739d30c81b5259c8b28ef9ea48c0d57 100644 --- a/electron/package.json +++ b/electron/package.json @@ -19,6 +19,7 @@ "license": "ISC", "dependencies": { "ffi-napi": "^4.0.3", + "hmc-win32": "^1.3.9", "win32-api": "^20.4.1" } }