View Single Post
  #1  
Old 08-23-2004, 12:25
SOLAR SOLAR is offline
Friend
 
Join Date: Aug 2004
Posts: 126
Rept. Given: 6
Rept. Rcvd 2 Times in 2 Posts
Thanks Given: 12
Thanks Rcvd at 6 Times in 6 Posts
SOLAR Reputation: 2
Functions within a Dll

Hey members..I have a dilemma...I have a dll (semcomn.dll) and I
dont know anything of the dll other than it has a few functions
inside of it..two functions mainly I'm interested in the Decrypt and
Encrypt functions.

The dilemma is I dont know what are the parameters that are being
passed to these two functions...

Here's the code for the program

Code:
#include <stdio.h>
#include <windows.h>

//	Compile with:
//
//		cl /c agent_pwd.c
//		link agent_pwd.obj

//	Run in ...\Program Files\Microsoft SQL Server\80\Tools\Binn OR place SEMCOMN.RLL in Resources\<LANGID>\ dir below current

// This is host_login_password from msdb.dbo.sp_get_sqlagent_properties
#define EncStr "\x7c\x3b\x57\x65\xee\xe0\x7c\x11\x3a\x5a\xe0\x41\xf8\xa3\x21\x16\x63\xb8\xf6\xbe\xf7\xd6\xfd\x3f\xb5\x19\x4b\xbe\x6b\xc0\xd9\x53"

int main(int argc, char * argv[])
{

BYTE Buff[100];
FARPROC pDecrypt;
HINSTANCE hSEMCOMN;
DWORD dwSize, i;

hSEMCOMN = LoadLibrary("SEMCOMN.DLL");

if(hSEMCOMN!=NULL){
	pDecrypt = GetProcAddress(hSEMCOMN, "Decrypt");

	if(pDecrypt!=NULL){

		dwSize = sizeof(Buff);

		// Actually, I do not know format of this function, but beleive that it is:
		// Decrypt(EncryptedData, EncryptedDataSize, ClearData, SizeOfClearData)
		// Last two params are pointers, as usual
		(pDecrypt)(EncStr, sizeof(EncStr), Buff, &dwSize);

		printf("PASSWORD: ");
		for(i=0;i<dwSize;i++)
			printf("%c", Buff[i]);
		printf("\n");

	} else {
		printf("Cannot get address of Decrypt(...), %d\n", GetLastError());
	}

} else {
	printf("Cannot load SEMCOMN.DLL, %d\n", GetLastError());
}

if(hSEMCOMN)
	FreeLibrary(hSEMCOMN);

return 0;
}
This is not my code...I have emailed the creator and waitin for a
reply...but any assistance from any of the members here will be
great help!!

Thnx in advance
SOLAR
Reply With Quote