11#include "extension_encryption.h"
2+ #include "common_metapi.h"
23
34ExtensionEncryptionManager * g_ExtensionEncryptionManager = NULL ;
45
5- DWORD cyptographic_manager_debug_initialize (LPVOID * lpCryptoContext , LPVOID lpParams ) {
6+ DWORD cryptographic_manager_debug_initialize (LPVOID * lpCryptoContext , LPVOID lpParams ) {
67 * lpCryptoContext = NULL ;
78 return 0 ;
89}
@@ -137,7 +138,7 @@ BOOL cryptographic_manager_debug(CryptographicManager* manager, LPVOID lpParams)
137138 }
138139 manager -> bInitialized = TRUE;
139140 manager -> bNeedsRefresh = FALSE;
140- manager -> initialize = cyptographic_manager_debug_initialize ;
141+ manager -> initialize = cryptographic_manager_debug_initialize ;
141142 manager -> encrypt = cryptographic_manager_debug_encrypt ;
142143 manager -> decrypt = cryptographic_manager_debug_decrypt ;
143144 manager -> lpCryptoParams = NULL ;
@@ -376,7 +377,7 @@ BOOL extension_encryption_encrypt(ExtensionEncryptionStatus* lpExtensionStatus)
376377 ExtensionLoc = lpExtensionStatus -> lpLoc ;
377378 ExtensionSize = lpExtensionStatus -> dwSize ;
378379
379- if (!VirtualProtect (ExtensionLoc , ExtensionSize , PAGE_READWRITE , & dwOldProtect )) {
380+ if (!met_api -> win_api . kernel32 . VirtualProtect (ExtensionLoc , ExtensionSize , PAGE_READWRITE , & dwOldProtect )) {
380381 dprintf ("[extension_encryption][extension_encryption_encrypt] VirtualProtect 1 failed with error 0x%x" , GetLastError ());
381382 bError = TRUE;
382383 }
@@ -410,7 +411,7 @@ BOOL extension_encryption_encrypt(ExtensionEncryptionStatus* lpExtensionStatus)
410411 bError = TRUE;
411412 break ;
412413 }
413- ret = WriteProcessMemory (GetCurrentProcess (), (unsigned char * )ExtensionLoc + i , lpTempBufferWrite , diff , & ByteCounter );
414+ ret = met_api -> win_api . kernel32 . WriteProcessMemory (GetCurrentProcess (), (unsigned char * )ExtensionLoc + i , lpTempBufferWrite , diff , & ByteCounter );
414415 if (!ret || ByteCounter != diff ) {
415416 dprintf ("[extension_encryption][extension_encryption_encrypt] WriteProcessMemory failed with error 0x%x" , GetLastError ());
416417 bError = TRUE;
@@ -424,7 +425,7 @@ BOOL extension_encryption_encrypt(ExtensionEncryptionStatus* lpExtensionStatus)
424425 }
425426 }
426427
427- if (!bError && !VirtualProtect (ExtensionLoc ,ExtensionSize ,dwOldProtect ,& dwOldProtect )){
428+ if (!bError && !met_api -> win_api . kernel32 . VirtualProtect (ExtensionLoc ,ExtensionSize ,dwOldProtect ,& dwOldProtect )){
428429 dprintf ("[extension_encryption][extension_encryption_encrypt] VirtualProtect 2 failed with error 0x%x" , GetLastError ());
429430 bError = TRUE;
430431 ret = FALSE;
@@ -476,7 +477,7 @@ BOOL extension_encryption_decrypt(ExtensionEncryptionStatus* lpExtensionStatus)
476477 ExtensionLoc = lpExtensionStatus -> lpLoc ;
477478 ExtensionSize = lpExtensionStatus -> dwSize ;
478479
479- if (!VirtualProtect (ExtensionLoc , ExtensionSize , PAGE_READWRITE , & dwOldProtect )) {
480+ if (!met_api -> win_api . kernel32 . VirtualProtect (ExtensionLoc , ExtensionSize , PAGE_READWRITE , & dwOldProtect )) {
480481 dprintf ("[extension_encryption][extension_encryption_decrypt] VirtualProtect 1 failed with error 0x%x" , GetLastError ());
481482 bError = TRUE;
482483 }
@@ -528,7 +529,7 @@ BOOL extension_encryption_decrypt(ExtensionEncryptionStatus* lpExtensionStatus)
528529 bError = TRUE;
529530 break ;
530531 }
531- ret = WriteProcessMemory (GetCurrentProcess (), (unsigned char * )ExtensionLoc + i , lpTempBufferWrite , diff , & ByteCounter );
532+ ret = met_api -> win_api . kernel32 . WriteProcessMemory (GetCurrentProcess (), (unsigned char * )ExtensionLoc + i , lpTempBufferWrite , diff , & ByteCounter );
532533 if (!ret || ByteCounter != diff ) {
533534 dprintf ("[extension_encryption][extension_encryption_decrypt] WriteProcessMemory failed with error 0x%x" , GetLastError ());
534535 bError = TRUE;
@@ -542,7 +543,7 @@ BOOL extension_encryption_decrypt(ExtensionEncryptionStatus* lpExtensionStatus)
542543 }
543544 }
544545
545- if (!bError && !VirtualProtect (ExtensionLoc ,ExtensionSize ,dwOldProtect ,& dwOldProtect )){
546+ if (!bError && !met_api -> win_api . kernel32 . VirtualProtect (ExtensionLoc ,ExtensionSize ,dwOldProtect ,& dwOldProtect )){
546547 dprintf ("[extension_encryption][extension_encryption_decrypt] VirtualProtect 2 failed with error 0x%x" , GetLastError ());
547548 bError = TRUE;
548549 ret = FALSE;
@@ -611,4 +612,4 @@ DWORD extensionFindDecrypt(LPVOID lpHandlerFunction) {
611612
612613 return ERROR_SUCCESS ;
613614
614- }
615+ }
0 commit comments