|
-
Jun 20th, 2001, 08:26 AM
#1
Problem with a DLL
Hello ...
Yesterday, I posted a question about a problem with one of our VB applications.
Today, we have localized the problem on a DLL which is called to creat a process. This DLL "eats" a handle each time the process is created, but does not free it after killing the process.
(This application is running on Windows NT4 server SP4)
Why ???
Here is the VC++ Code of the DLL :
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <winbase.h>
extern __declspec (dllexport) _int16 LancSync (HWND hWnd,
char * pszBatchName,
char * pszBatchParam,
_int16 iShowHow )
{
PROCESS_INFORMATION proc;
STARTUPINFO start;
int iReturnValue;
char szTmp[200];
GetStartupInfo (&start);
start.dwFlags = start.dwFlags | STARTF_USESHOWWINDOW;
start.wShowWindow = iShowHow;
sprintf(szTmp,"%s %s",pszBatchName,pszBatchParam);
iReturnValue = CreateProcessA(NULL, szTmp, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &start, &proc);
if (iReturnValue == 0 )
return -1;
iReturnValue = WaitForSingleObject(proc.hProcess, INFINITE);
CloseHandle(proc.hProcess);
return (0);
}
Thanks a lot.
Gab
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|