git-extra (WhoUses): fix compiler warnings

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2015-09-19 16:34:36 +02:00
Родитель 2d37e02a64
Коммит 8e8e483c5d
3 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -100,7 +100,7 @@ BOOL SystemInfoUtils::GetFsFileName( LPCTSTR lpDeviceFileName,
//Mapped network drive //Mapped network drive
char cDriveLetter; char cDriveLetter;
DWORD dwParam; int dwParam;
TCHAR lpSharedName[0x1000]; TCHAR lpSharedName[0x1000];
@ -166,7 +166,7 @@ BOOL SystemInfoUtils::GetDeviceFileName( LPCTSTR lpFsFileName,
//Mapped network drive //Mapped network drive
char cDriveLetter; char cDriveLetter;
DWORD dwParam; int dwParam;
TCHAR lpSharedName[0x1000]; TCHAR lpSharedName[0x1000];
@ -356,7 +356,7 @@ BOOL SystemThreadInformation::Refresh()
SystemHandleInformation::SYSTEM_HANDLE& h = *iter; SystemHandleInformation::SYSTEM_HANDLE& h = *iter;
ti.ProcessId = h.ProcessID; ti.ProcessId = h.ProcessID;
ti.ThreadHandle = (HANDLE)h.HandleNumber; ti.ThreadHandle = (HANDLE)(DWORD_PTR)h.HandleNumber;
// This is one of the threads we are lokking for // This is one of the threads we are lokking for
if ( SystemHandleInformation::GetThreadId( ti.ThreadHandle, if ( SystemHandleInformation::GetThreadId( ti.ThreadHandle,
@ -480,7 +480,7 @@ BOOL SystemHandleInformation::Refresh()
else else
{ {
// Type filtering // Type filtering
GetTypeToken( (HANDLE)pSysHandleInformation GetTypeToken( (HANDLE)(DWORD_PTR)pSysHandleInformation
->Handles[i].HandleNumber, ->Handles[i].HandleNumber,
strType, strType,
pSysHandleInformation pSysHandleInformation
@ -770,8 +770,6 @@ BOOL SystemHandleInformation::GetThreadId( HANDLE h, DWORD& threadID, DWORD proc
//Process related functions //Process related functions
BOOL SystemHandleInformation::GetProcessPath( HANDLE h, string& strPath, DWORD remoteProcessId ) BOOL SystemHandleInformation::GetProcessPath( HANDLE h, string& strPath, DWORD remoteProcessId )
{ {
h; strPath; remoteProcessId;
stringstream number; stringstream number;
number << remoteProcessId; number << remoteProcessId;
strPath = number.str(); strPath = number.str();
@ -999,7 +997,7 @@ BOOL SystemModuleInformation::Refresh()
} }
// Everey process or just a particular one // Everey process or just a particular one
if ( m_processId != -1 ) if ( m_processId != (DWORD)-1 )
// For a particular one // For a particular one
GetModuleListForProcess( m_processId ); GetModuleListForProcess( m_processId );
else else
@ -1067,7 +1065,7 @@ BOOL CALLBACK SystemWindowInformation::EnumerateWindows( HWND hwnd, LPARAM lPara
GetWindowThreadProcessId(hwnd, &wi.ProcessId ) ; GetWindowThreadProcessId(hwnd, &wi.ProcessId ) ;
// Filtering by process ID // Filtering by process ID
if ( _this->m_processId == -1 || _this->m_processId == wi.ProcessId ) if ( _this->m_processId == (DWORD)-1 || _this->m_processId == wi.ProcessId )
{ {
GetWindowText( hwnd, wi.Caption, MaxCaptionSize ); GetWindowText( hwnd, wi.Caption, MaxCaptionSize );

Просмотреть файл

@ -14,12 +14,14 @@
#error You need Windows NT to use this source code. Define WINNT! #error You need Windows NT to use this source code. Define WINNT!
#endif #endif
#ifdef _MSC_VER
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#pragma warning( disable : 4786 ) #pragma warning( disable : 4786 )
#pragma warning( disable : 4200 ) #pragma warning( disable : 4200 )
#endif
#include <map> #include <map>
#include <string> #include <string>

Просмотреть файл

@ -71,7 +71,7 @@ void WhoUsesModule( LPCTSTR lpFileName, BOOL bFullPathCheck )
processName = ""; processName = "";
_tprintf( _T("0x%04X %-20s %s\n"), _tprintf( _T("0x%04X %-20s %s\n"),
m.ProcessId, (unsigned int)m.ProcessId,
processName.c_str(), processName.c_str(),
m.FullPath ); m.FullPath );
} }
@ -125,7 +125,7 @@ void WhoUsesFile( LPCTSTR lpFileName, BOOL bFullPathCheck )
if ( INtDll::dwNTMajorVersion == 4 && _tcsicmp( processName.c_str(), _T("services.exe" ) ) == 0 ) if ( INtDll::dwNTMajorVersion == 4 && _tcsicmp( processName.c_str(), _T("services.exe" ) ) == 0 )
continue; continue;
hi.GetName( (HANDLE)h.HandleNumber, name, (DWORD)h.ProcessID ); hi.GetName( (HANDLE)(DWORD_PTR)h.HandleNumber, name, (DWORD)h.ProcessID );
if ( bFullPathCheck ) if ( bFullPathCheck )
bShow = _tcsicmp( name.c_str(), deviceFileName.c_str() ) == 0; bShow = _tcsicmp( name.c_str(), deviceFileName.c_str() ) == 0;
@ -141,7 +141,7 @@ void WhoUsesFile( LPCTSTR lpFileName, BOOL bFullPathCheck )
} }
_tprintf( _T("0x%04X %-20s %s\n"), _tprintf( _T("0x%04X %-20s %s\n"),
h.ProcessID, (unsigned int)h.ProcessID,
processName.c_str(), processName.c_str(),
!bFullPathCheck ? fsFilePath.c_str() : lpFileName ); !bFullPathCheck ? fsFilePath.c_str() : lpFileName );
} }
@ -158,13 +158,13 @@ void EnableDebugPriv( void )
if ( ! OpenProcessToken( GetCurrentProcess(), if ( ! OpenProcessToken( GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) ) TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) )
{ {
_tprintf( _T("OpenProcessToken() failed, Error = %d SeDebugPrivilege is not available.\n") , GetLastError() ); _tprintf( _T("OpenProcessToken() failed, Error = %d SeDebugPrivilege is not available.\n") , (int)GetLastError() );
return; return;
} }
if ( ! LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &sedebugnameValue ) ) if ( ! LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &sedebugnameValue ) )
{ {
_tprintf( _T("LookupPrivilegeValue() failed, Error = %d SeDebugPrivilege is not available.\n"), GetLastError() ); _tprintf( _T("LookupPrivilegeValue() failed, Error = %d SeDebugPrivilege is not available.\n"), (int)GetLastError() );
CloseHandle( hToken ); CloseHandle( hToken );
return; return;
} }
@ -174,7 +174,7 @@ void EnableDebugPriv( void )
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if ( ! AdjustTokenPrivileges( hToken, FALSE, &tkp, sizeof tkp, NULL, NULL ) ) if ( ! AdjustTokenPrivileges( hToken, FALSE, &tkp, sizeof tkp, NULL, NULL ) )
_tprintf( _T("AdjustTokenPrivileges() failed, Error = %d SeDebugPrivilege is not available.\n"), GetLastError() ); _tprintf( _T("AdjustTokenPrivileges() failed, Error = %d SeDebugPrivilege is not available.\n"), (int)GetLastError() );
CloseHandle( hToken ); CloseHandle( hToken );
} }
@ -249,7 +249,7 @@ int _tmain(int argc, TCHAR* argv[])
{ {
if ( GetFullPathName( lpPath, _MAX_PATH, lpFilePath, NULL ) == 0 ) if ( GetFullPathName( lpPath, _MAX_PATH, lpFilePath, NULL ) == 0 )
{ {
_tprintf( _T("GetFullPathName() failed. Error = %d\n"), GetLastError() ); _tprintf( _T("GetFullPathName() failed. Error = %d\n"), (int)GetLastError() );
return -2; return -2;
} }
} }