Matrix Posted September 18, 2007 Posted September 18, 2007 Hi Freind i encrypted a file with AES algorithm and i want decrypt it into Memory via a Program, i don`t want make any temp file . plz help me
Ziggy Posted September 18, 2007 Posted September 18, 2007 Use the heap. You can grab all the temporary memory you need and decrypt inside the program then release the memory.see reference to the Windows api GlobalAllocZ
Matrix Posted September 19, 2007 Author Posted September 19, 2007 Use the heap. You can grab all the temporary memory you need and decrypt inside the program then release the memory.see reference to the Windows api GlobalAlloc Z Hi Friend tanx , may you give me a example from Visual Basic , because i am beginner
Ziggy Posted September 19, 2007 Posted September 19, 2007 (edited) hmmm.. I code in MASM, C and Delphi. I don't have an example using Visual Basic - sorry. Maybe another forum member may have an example. Maybe a Google will find some examples for you.cheersZ Edited September 19, 2007 by Ziggy
Matrix Posted September 19, 2007 Author Posted September 19, 2007 hmmm.. I code in MASM, C and Delphi. I don't have an example using Visual Basic - sorry. Maybe another forum member may have an example. Maybe a Google will find some examples for you. cheers Z Tnax a lot of my Friend
Ziggy Posted September 19, 2007 Posted September 19, 2007 Here is what a Google turned up. A nice simple example.' Use a block of memory as an intermediary step to copy' the contents of array s() to array t(). Yes, you could copy them directly,' but this demonstrates a few different memory functions.Dim s(0 To 255) As Integer, t(0 To 255) As Integer ' arrays to copy from/toDim c As Integer, retval As Long ' counter variable & return valueDim hMem As Long, pMem As Long ' handle and pointer to memory block' Initialize the source array s()'s dataFor c = 0 To 255 s© = 2 * c ' each element equals double its indexNext c' Allocate a moveable block of memory (returns a handle) (Integer type = 2 bytes)hMem = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, 256 * 2)' Lock the memory block, returning a pointer to itpMem = GlobalLock(hMem)' Copy the entire contents of s() to the memory block' Note that pMem is ByVal because we want its contents, not a pointer to itCopyMemory ByVal pMem, s(0), 256 * 2' Copy the contents of the memory block to t() (we could have just copied s() to t())CopyMemory t(0), ByVal pMem, 256 * 2' Unlock the memory block, destroying the pointer and freeing resourcesx = GlobalUnlock(hMem)' Free the memory block (de-allocate it)x = GlobalFree(hMem)' Verify that t() = s(), which it shouldFor c = 0 To 255 If s© <> t© Then Debug.Print "Copy attempt failed."End IfI'm no VB'er but it looks ok to me.Z
starzboy Posted September 21, 2007 Posted September 21, 2007 (edited) @Matrixif the file is too big , then you can use Global Alloc [like Ziggy said] and read first block from file to Buffer,decryptwrite decrypted block to fileread next block from file to Buffer,decryptwrite next block to file.... continue until lastPS* Assuming that you will need to save a decrypted file since you have encrypted it Edited September 21, 2007 by starzboy
midnewbie Posted September 22, 2007 Posted September 22, 2007 i think what he wanted is to Execute a crypted file on memory , dude see P0ke crypter if you in delphi.
Matrix Posted September 22, 2007 Author Posted September 22, 2007 i think what he wanted is to Execute a crypted file on memory , dude see P0ke crypter if you in delphi. yes i want execute a crypted file on memory and use VB , can you help me dear ?
midnewbie Posted September 23, 2007 Posted September 23, 2007 simply you cant you know why there is no Power in vb meaning POINTERS are not supported in VB try CPP or delphi.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now