作者在 2009-07-22 11:46:05 发布以下内容
DWORD GetServiceInfFilePath_Passthru(
LPTSTR lpFilename,
DWORD nSize
)
{
// Get Path to This Module
DWORD nResult;
TCHAR szDrive[ MAX_PATH ];
TCHAR szDir[ MAX_PATH ];
nResult = GetModuleFileName( NULL, lpFilename, nSize );
if( nResult == 0 )
{
return 0;
}
_splitpath( lpFilename, szDrive, szDir, NULL, NULL );
_makepath( lpFilename, szDrive, szDir, "netsf", ".inf" );
return (DWORD )strlen( lpFilename );
}
LPTSTR lpFilename,
DWORD nSize
)
{
// Get Path to This Module
DWORD nResult;
TCHAR szDrive[ MAX_PATH ];
TCHAR szDir[ MAX_PATH ];
nResult = GetModuleFileName( NULL, lpFilename, nSize );
if( nResult == 0 )
{
return 0;
}
_splitpath( lpFilename, szDrive, szDir, NULL, NULL );
_makepath( lpFilename, szDrive, szDir, "netsf", ".inf" );
return (DWORD )strlen( lpFilename );
}
int main(int argc, char* argv[])
{
printf("Hello World!\n");
char lpFilename[MAX_PATH] = {0};
DWORD nSize = sizeof(lpFilename);
GetServiceInfFilePath_Passthru(lpFilename,nSize);
return 0;
}