-
-
Save jakogut/f429540cf8487ff24115 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
#define CMT_OK 1 | |
typedef int (__stdcall *CmtInitDbQryDll)(); | |
typedef int (__stdcall *CmtGetRecordDataByRecId)(); | |
#define REQ_BUFF_SZ (strlen(db_request)) | |
char *db_request = "<?xml version=\"1.0\" ?>" | |
"<?commitcrmxmlgetrecorddatarequest version=\"1.0\" ?>" | |
"<CommitCRMGetRecordDataRequest>" | |
" <ExternalApplicationName>Leak Test</ExternalApplicationName>" | |
" <GetRecordByRecId>CRDCKQVFTYBTJFWSN8E1</GetRecordByRecId>" | |
" <SelectFieldsList>FLDCRDCONTACT</SelectFieldsList>" | |
"</CommitCRMGetRecordDataRequest>"; | |
#define RESP_BUFF_SZ (2 << 13) | |
char db_response[RESP_BUFF_SZ]; | |
int main(void) { | |
char *library = "C:\\CommitCRM\\Server\\cmtdbqry.dll"; | |
HINSTANCE DbQryDll = LoadLibraryEx(library, NULL, 0x100 | 0x1000); | |
if(DbQryDll == NULL) { | |
printf("Could not load library.\n"); | |
return; | |
} else printf("Loaded library: %s at %p\n", library, DbQryDll); | |
CmtInitDbQryDll db_init = (CmtInitDbQryDll)GetProcAddress(DbQryDll, "CmtInitDbQryDll"); | |
CmtGetRecordDataByRecId get_record_data = | |
(CmtGetRecordDataByRecId)GetProcAddress(DbQryDll, "CmtGetRecordDataByRecId"); | |
char *appname = "Leak Test"; | |
char *path = "C:\\CommitCRM\\Db"; | |
int status = 0; | |
db_init(appname, path, &status); | |
if(status != CMT_OK) { | |
printf("Failed to initialize database connection."); | |
return; | |
} | |
while(status == CMT_OK) | |
get_record_data(db_request, REQ_BUFF_SZ, db_response, RESP_BUFF_SZ, &status); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment