diff --git "a/course/html/2023-09-16--\350\247\206\351\242\221.html" "b/course/html/2023-09-16--\350\247\206\351\242\221.html" new file mode 100644 index 0000000000000000000000000000000000000000..007c102a662f503b9f39fbb5ae16f49be3c4324e --- /dev/null +++ "b/course/html/2023-09-16--\350\247\206\351\242\221.html" @@ -0,0 +1,16 @@ + + + + + + Document + + + + + + \ No newline at end of file diff --git a/electron/index.js b/electron/index.js index 9ae05ad1fea283f987627a7857863230ff149302..e583f42f26e0032d1ad6d7a5cee761442283282c 100644 --- a/electron/index.js +++ b/electron/index.js @@ -1,5 +1,4 @@ -var ffi = require('ffi-napi'); - +import ffi from 'ffi-napi' // var libm = ffi.Library('libm', { // 'ceil': [ 'double', [ 'double' ] ] // }); @@ -15,3 +14,9 @@ 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); diff --git a/electron/package.json b/electron/package.json index 177e7bb00d7f1348fca88504f6e0285c4303afd9..d300a41d5c798a6079a61598cf5822c72815bb60 100644 --- a/electron/package.json +++ b/electron/package.json @@ -8,8 +8,12 @@ "doc": "doc" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "foo2": "node win32-api.js" + "-----": "run", + "dev": "npm run node-ffi-napi", + "node-ffi-napi": "node index.js", + "node-win32-api": "node win32-api.js", + "------": "tools", + "gitPull": "git pull" }, "author": "khz", "license": "ISC", diff --git a/electron/win32-api.js b/electron/win32-api.js index 7420fcd6e333dab296887ad32aed7effb6a7792c..fd639693351cceacf77bab868bf16d5d6c7afb6b 100644 --- a/electron/win32-api.js +++ b/electron/win32-api.js @@ -7,7 +7,7 @@ * Kernel32: kernel32 from lib/kernel32/api * User32: user32 from lib/user32/api */ -import { Kernel32, User32 } from 'win32-api/promise' +import { Kernel32, User32, Ntdll } from 'win32-api/promise' import ref from 'ref-napi' const knl32 = Kernel32.load() @@ -33,4 +33,10 @@ user32.CloseWindow(hWnd) // } // else { // console.log('window title changed') -// } \ No newline at end of file +// } + +function 挂起进程() { + Ntdll.NtSuspendProcess(-1) +} + +挂起进程()