Found a problem, when I call EncryptString or DecryptString using my own char array, it looks as if your dll is trying to free it or something.
In the debug window I see:
HEAP[m220.exe]: Invalid Address specified to RtlFreeHeap( 00820000, 001596D8 )
HEAP[m220.exe]: Invalid Address specified to RtlFreeHeap( 00820000, 00159728 )
m220 is the name of my program, here is some example code which will reproduce the same error:
#include <stdio.h>
#include <windows.h>
char * (__stdcall *DecryptString)(char *, char *,char *, int);
char * (__stdcall *EncryptString)(char *, char *,char *, int);
void (__stdcall *FreeResultString)(char *);
int main(int argc, char **argv)
{
char *v;
char result[1024];
HINSTANCE hDll;
if ( argc == 1 )
{
fprintf(stdout,"usage: %s [key] [text]\n",argv[0]);
exit(1);
}
hDll = LoadLibrary("mircryption.dll");
if ( hDll == NULL)
{
fprintf(stdout,"Error loading dll %u\n",GetLastError());
exit(1);
}
DecryptString = (void *)GetProcAddress(hDll,"DecryptString");
EncryptString = (void *)GetProcAddress(hDll,"EncryptString");
FreeResultString = (void *)GetProcAddress(hDll,"FreeResultString");
if ( DecryptString == NULL || EncryptString == NULL || FreeResultString == NULL )
{
fprintf(stdout,"Error finding exported functions from the dll!\n");
exit(1);
}
v = EncryptString(argv[1],argv[2],result,sizeof(result));
fprintf(stdout,"%s\n",v);
getchar();
}
debug this program, and youll end up at an int 3 breakpoint inside ntdll.dll
It also looks as if your dll is leaking memory?