@@ -37,7 +37,7 @@ DWORD cryptographic_manager_rc4_initialize(LPVOID* lpCryptoContext, LPVOID lpPar
3737 }
3838
3939 RC4_CTX * ctx = (RC4_CTX * )(* lpCryptoContext );
40- InitRc4 (ctx , (LPSTR )lpParams , strlen (( LPSTR ) lpParams ) );
40+ InitRc4 (ctx , (unsigned char * )lpParams , KEY_SIZE_RC4 );
4141 return 0 ;
4242}
4343
@@ -47,7 +47,8 @@ DWORD cryptographic_manager_rc4_refresh(LPVOID lpCryptoContext, LPVOID lpParams)
4747 dprintf ("[cryptographic_manager_rc4_refresh] lpCryptoContext is NULL." );
4848 return ERROR_INVALID_PARAMETER ;
4949 }
50- InitRc4 (ctx , (LPSTR )lpParams , strlen ((LPSTR )lpParams ));
50+ InitRc4 (ctx , (unsigned char * )lpParams , KEY_SIZE_RC4 );
51+ dprintf ("[cryptographic_manager_rc4] Refreshed RC4 Cryptographic Manager." );
5152 return 0 ;
5253}
5354
@@ -93,6 +94,7 @@ BOOL cryptographic_manager_rc4(CryptographicManager* manager, LPVOID lpParams) {
9394 dprintf ("[cryptographic_manager_rc4] Invalid parameters." );
9495 return FALSE;
9596 }
97+ dprintf ("[cryptographic_manager_rc4] Initializing RC4 Cryptographic Manager." );
9698 manager -> bInitialized = TRUE;
9799 manager -> bNeedsRefresh = TRUE;
98100 manager -> initialize = cryptographic_manager_rc4_initialize ;
@@ -203,7 +205,13 @@ BOOL extension_encryption_add(LPVOID lpExtensionLocation, DWORD dwExtensionSize)
203205 lpExtensionStatus -> lpLoc = lpExtensionLocation ;
204206 lpExtensionStatus -> dwSize = dwExtensionSize ;
205207 lpExtensionStatus -> dwLastUsedTime = GetTickCount ();
208+ dprintf ("[extension_encryption][extension_encryption_add] lpExtensionStatus->bEncryptable: %d" , lpExtensionStatus -> bEncryptable );
209+ dprintf ("[extension_encryption][extension_encryption_add] lpExtensionStatus->bEncrypted: %d" , lpExtensionStatus -> bEncrypted );
210+ dprintf ("[extension_encryption][extension_encryption_add] lpExtensionStatus->lpLoc: %p" , lpExtensionStatus -> lpLoc );
211+ dprintf ("[extension_encryption][extension_encryption_add] lpExtensionStatus->dwSize: %u" , lpExtensionStatus -> dwSize );
212+ dprintf ("[extension_encryption][extension_encryption_add] lpExtensionStatus->dwLastUsedTime: %u" , lpExtensionStatus -> dwLastUsedTime );
206213 g_ExtensionEncryptionManager -> extensionStatuses [g_ExtensionEncryptionManager -> dwExtensionsCount - 1 ] = lpExtensionStatus ;
214+ dprintf ("[extension_encryption][extension_encryption_add] Added extension at %p of size %u" , lpExtensionLocation , dwExtensionSize );
207215 ret = TRUE;
208216 LeaveCriticalSection (& g_ExtensionEncryptionManager -> cs );
209217 return ret ;
@@ -313,6 +321,7 @@ BOOL extension_encryption_encrypt(ExtensionEncryptionStatus* lpExtensionStatus)
313321 }
314322
315323 lpExtensionStatus -> dwLastUsedTime = GetTickCount ();
324+ lpExtensionStatus -> bEncrypted = TRUE;
316325 LeaveCriticalSection (& g_ExtensionEncryptionManager -> cs );
317326 return ret ;
318327}
@@ -356,12 +365,11 @@ BOOL extension_encryption_decrypt(ExtensionEncryptionStatus* lpExtensionStatus)
356365
357366 if ( g_ExtensionEncryptionManager -> cryptoManager .bNeedsRefresh ) {
358367 if (g_ExtensionEncryptionManager -> cryptoManager .refresh != NULL ) {
359- if (g_ExtensionEncryptionManager -> cryptoManager .refresh (g_ExtensionEncryptionManager -> cryptoManager .lpCryptoContext , g_ExtensionEncryptionManager -> cryptoManager .lpCryptoParams ) != 0 ) {
368+ if (g_ExtensionEncryptionManager -> cryptoManager .refresh (g_ExtensionEncryptionManager -> cryptoManager .lpCryptoContext , ( LPVOID ) g_ExtensionEncryptionManager -> cryptoManager .lpCryptoParams ) != 0 ) {
360369 dprintf ("[extension_encryption][extension_encryption_decrypt] CryptographicManager refresh failed." );
361370 LeaveCriticalSection (& g_ExtensionEncryptionManager -> cs );
362371 return FALSE;
363372 }
364- g_ExtensionEncryptionManager -> cryptoManager .bNeedsRefresh = FALSE;
365373 }
366374 }
367375
@@ -387,6 +395,7 @@ BOOL extension_encryption_decrypt(ExtensionEncryptionStatus* lpExtensionStatus)
387395 }
388396
389397 lpExtensionStatus -> dwLastUsedTime = GetTickCount ();
398+ lpExtensionStatus -> bEncrypted = FALSE;
390399 LeaveCriticalSection (& g_ExtensionEncryptionManager -> cs );
391400 return ret ;
392401}
0 commit comments