2

This VBA code was written to break password of any VBA Project. It is explained here that Public variables retain their values even after execution of VBA module. Is it possible that following VBA code (stored at Module Level or Class Level) be modified in such a way to prevent execution of (aforesaid VBA code) breaking of Project password? :-

Public Dim HookBytes(0 To 5) As Byte
Dim OriginBytes(0 To 5) As Byte
Dim pFunc As LongPtr
Dim Flag As Boolean

ReDim HookBytes(0) As Byte
ReDim OriginBytes(0) As Byte
pFunc = 9223372036854775807 ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/longptr-data-type
Flag = True
Sukumar
  • 319
  • 3
  • 10

1 Answers1

0

The 'Password breaker' you provided contains the same declarations as the ones you are wanting to store as public variables.

You are basically wanting to "Hi-Jack" these variables before the code has begun.

The only problem is that once the routine was to run, the publicly declared variables will now become procedural variables within the scope of the routine itself as soon as they are declared within Sub. The public variables will essentially be ignored as soon as the Dim statement within the procedure declares the same variable name.

Essentially, the method you are wanting to use to stop the password breaker will not work unfortunately.

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43