Index: windows-NT/win32.cpp =================================================================== RCS file: /usr/local/cvs/cvsnt/windows-NT/win32.c,v retrieving revision 1.72.2.150.6.44.2.59 diff -c -r1.72.2.150.6.44.2.59 win32.cpp *** windows-NT/win32.cpp 19 Aug 2024 01:12:27 -0000 1.72.2.150.6.44.2.59 --- windows-NT/win32.cpp 25 Aug 2024 11:54:09 -0000 *************** *** 63,71 **** #ifndef CVS95 int ci_directory_list_size; char **ci_directory_list; #ifdef _WIN32 ! HANDLE hTerminateSem; ! HANDLE hRetrySem; #endif _WIN32 #endif --- 63,72 ---- #ifndef CVS95 int ci_directory_list_size; char **ci_directory_list; + char SemaphoreBuffer[2048]; #ifdef _WIN32 ! HANDLE hTerminateSem=NULL; ! HANDLE hRetrySem = NULL; #endif _WIN32 #endif *************** *** 597,603 **** printf ("Microsoft Win32s"); break; } ! _stprintf(osvw+_tcsclen(osvw), TEXT(" [%d.%d.%d] %s"),osex.dwMajorVersion,osex.dwMinorVersion,osex.dwBuildNumber,(g_running_on_win32_dc)?"Domain Controller":""); #ifdef _MBCS // this code should never be called since we either compile in ASCII for win9x or UNICODE for winnt // I just wrote this "in case"... --- 598,604 ---- printf ("Microsoft Win32s"); break; } ! _stprintf(osvw+_tcsclen(osvw), TEXT(" [%d.%d.%d] %s"),osex.dwMajorVersion,osex.dwMinorVersion,osex.dwBuildNumber,(g_running_on_win32_dc)?TEXT("Domain Controller"):TEXT("")); #ifdef _MBCS // this code should never be called since we either compile in ASCII for win9x or UNICODE for winnt // I just wrote this "in case"... *************** *** 1793,1800 **** CvsCloseFilter(); if (hRetrySem!=NULL) CloseHandle(hRetrySem); ! if (hTerminateSem!=NULL) CloseHandle(hTerminateSem); #endif if(!server_active) --- 1794,1831 ---- CvsCloseFilter(); if (hRetrySem!=NULL) CloseHandle(hRetrySem); ! if (hTerminateSem != NULL) ! { ! // the semaphore is released in wmain(), but since it is closed here first, that never happs. ! // if we do close it here, we get an early termination error log from cvsproxy. ! // ! // ******************* ! // Client process still active, unable to determine the correct return status. Returning ZERO. This may be an error. ! // ! // Command: cvs --noantivirus --allow - root = "d:\cvsbin\release builder\cvsnt\testcvs/repos_0,/repos" - d / repos version ! // User : abarrett ! // ******************* ! // ! // so I'm commenting this out ! /*TRACE(3, "Set the terminate semaphore (wnt_cleanup)"); ! //SetEvent (hTerminateSem); ! if (ReleaseSemaphore(hTerminateSem, 1, NULL) == 0) ! { ! DWORD dwErr = GetLastError(); ! LPVOID errbuf = NULL; ! FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&errbuf, 0, NULL); ! TRACE(3, "Failed to release semaphore! (wnt_cleanup) %08x: \"%s\".", dwErr, errbuf); ! CServerIo::log(CServerIo::logError, "Failed to release semaphore! (wnt_cleanup) %08x: \"%s\".", dwErr, errbuf); ! LocalFree(errbuf); ! } ! else */ CloseHandle(hTerminateSem); + hTerminateSem = NULL; + } + else + { + TRACE(3, "The terminate semaphore was already NULL! (wnt_cleanup)"); + } #endif if(!server_active) *************** *** 4991,4997 **** dwError = GetLastError(); errbuf = NULL; FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwError,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPSTR)&errbuf,0,NULL); ! _stprintf(szsi,_T("installed %s: %s"),(mstat.dwCurrentState&SERVICE_RUNNING)?_T("running"):_T("not running"),errbuf); LocalFree( errbuf ); errbuf = NULL; } --- 5022,5028 ---- dwError = GetLastError(); errbuf = NULL; FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwError,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPSTR)&errbuf,0,NULL); ! _stprintf(szsi,_T("installed %s: %S"),(mstat.dwCurrentState&SERVICE_RUNNING)?_T("running"):_T("not running"),(LPSTR)errbuf); LocalFree( errbuf ); errbuf = NULL; } *************** *** 5750,5756 **** #endif ! _snprintf(Buffer,sizeof(Buffer),"/cvspro/prods-pre.asp?register=crash&crash=cvsnt&file=%s.dmp.gz&os=%s&sp=%s&ver=%s&cmd=%s&owner=%s&org=%s&user=%s&computer=%s&avgtime=%u&up=%u&users=%u&uusers=%u&susers=%u&id=%s&cp=%u&major=%u&minor=%u", szNameOfFile,OSBuffer,SPBuffer,CVSNT_PRODUCTVERSION_SHORT,CMDBuffer,OwnerBuffer,OrgBuffer,UserBuffer,ComputerBuffer,0,0,0,0,0,0,dwCodepage,dwMajor,dwMinor); BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); --- 5781,5787 ---- #endif ! _snprintf(Buffer,sizeof(Buffer),"/cvspro/prods-pre.asp?register=crash&crash=cvsnt&file=%s.dmp.gz&os=%s&sp=%s&ver=%s&cmd=%s&owner=%s&org=%s&user=%s&computer=%s&avgtime=%u&up=%u&users=%u&uusers=%u&susers=%u&id=%lu&cp=%u&major=%u&minor=%u", szNameOfFile,OSBuffer,SPBuffer,CVSNT_PRODUCTVERSION_SHORT,CMDBuffer,OwnerBuffer,OrgBuffer,UserBuffer,ComputerBuffer,0,0,0,0,0,0,dwCodepage,dwMajor,dwMinor); BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); *************** *** 6317,6322 **** --- 6348,6354 ---- #endif #ifndef CVS95 + ZeroMemory(SemaphoreBuffer, 2048); hTerminateSem=NULL; hRetrySem=NULL; // this is just here to aid in debugging. The result will (hopefully) sit on the *************** *** 6513,6522 **** free(buf); free(newargv); #ifdef _WIN32 ! TRACE(3,"Set the terminate semaphore"); //SetEvent (hTerminateSem); ! ReleaseSemaphore (hTerminateSem, 1, NULL); ! CloseHandle(hTerminateSem); TRACE(3,"Free trace_file"); xfree(trace_file); --- 6545,6573 ---- free(buf); free(newargv); #ifdef _WIN32 ! if (hTerminateSem!=NULL) ! { ! TRACE(3,"Set the terminate semaphore (wmain)"); //SetEvent (hTerminateSem); ! if (ReleaseSemaphore(hTerminateSem, 1, NULL) == 0) ! { ! DWORD dwErr = GetLastError(); ! LPVOID errbuf = NULL; ! FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&errbuf, 0, NULL); ! TRACE(3, "Failed to release semaphore! (wmain) %08x: \"%s\".", dwErr, errbuf); ! // the semaphore is usually closed in wnt_cleanup() so the semaphore is never released first... ! // so I don't see why it warrants an event log?!? ! //CServerIo::log(CServerIo::logError, "Failed to release semaphore! (wmain) %08x: \"%s\".", dwErr, errbuf); ! LocalFree(errbuf); ! } ! else ! CloseHandle(hTerminateSem); ! hTerminateSem = NULL; ! } ! else ! { ! TRACE(3, "The terminate semaphore was already NULL! (wmain)"); ! } TRACE(3,"Free trace_file"); xfree(trace_file); *************** *** 6619,6630 **** { sharepath=(LPCSTR)p->shi502_path; if (_strnicmp(sharepath.c_str(),infile.c_str(),len_shi502_path)==0) ! sprintf(pshr,"** !%-20S%-30S%-8u",(LPCSTR)p->shi502_netname, sharepath.c_str(), p->shi502_current_uses); else ! sprintf(pshr,"** %-20S%-30S%-8u",(LPCSTR)p->shi502_netname, (LPCSTR)p->shi502_path, p->shi502_current_uses); } else ! sprintf(pshr,"** %-20S%-30S%-8u",(LPCSTR)p->shi502_netname, (LPCSTR)p->shi502_path, p->shi502_current_uses); // // Validate the value of the // shi502_security_descriptor member. --- 6670,6681 ---- { sharepath=(LPCSTR)p->shi502_path; if (_strnicmp(sharepath.c_str(),infile.c_str(),len_shi502_path)==0) ! sprintf(pshr,"** !%-20s%-30s%-8u",(LPCSTR)p->shi502_netname, sharepath.c_str(), p->shi502_current_uses); else ! sprintf(pshr,"** %-20s%-30s%-8u",(LPCSTR)p->shi502_netname, (LPCSTR)p->shi502_path, p->shi502_current_uses); } else ! sprintf(pshr,"** %-20s%-30s%-8u",(LPCSTR)p->shi502_netname, (LPCSTR)p->shi502_path, p->shi502_current_uses); // // Validate the value of the // shi502_security_descriptor member.