diff options
author | George Hazan <ghazan@miranda.im> | 2021-12-26 20:31:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-12-26 20:31:39 +0300 |
commit | cddcd7483a7c472598af098e759e5d309024f606 (patch) | |
tree | b0a227d6e087c41958cc84d27bc323353248aae5 /plugins/PluginUpdater | |
parent | 1039b2829a264280493ba0fa979214fe024dc70c (diff) |
DWORD -> uint32_t
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r-- | plugins/PluginUpdater/pu_stub/src/pu_stub.cpp | 14 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 10 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/PluginUpdater.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/checksum.cpp | 46 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 12 |
6 files changed, 43 insertions, 43 deletions
diff --git a/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp b/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp index 84362caad6..3da0773ec8 100644 --- a/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp +++ b/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp @@ -25,7 +25,7 @@ int CreateDirectoryTreeW(const wchar_t* szDir) if (lstrcpynW(szTestDir, szDir, MAX_PATH) == nullptr) szTestDir[MAX_PATH] = 0; - DWORD dwAttributes = GetFileAttributesW(szTestDir); + uint32_t dwAttributes = GetFileAttributesW(szTestDir); if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) return 0; @@ -74,7 +74,7 @@ void CreatePathToFileW(wchar_t *wszFilePath) int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) { - DWORD dwError; + uint32_t dwError; wchar_t tszPipeName[MAX_PATH]; #if _MSC_VER < 1400 @@ -95,8 +95,8 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) uint8_t szReadBuffer[1024] = { 0 }; DWORD dwBytes; while (ReadFile(hPipe, szReadBuffer, sizeof(szReadBuffer), &dwBytes, nullptr)) { - DWORD dwAction = *(DWORD*)szReadBuffer; - wchar_t *ptszFile1 = (wchar_t*)(szReadBuffer + sizeof(DWORD)); + uint32_t dwAction = *(uint32_t*)szReadBuffer; + wchar_t *ptszFile1 = (wchar_t*)(szReadBuffer + sizeof(uint32_t)); wchar_t *ptszFile2 = ptszFile1 + wcslen(ptszFile1) + 1; dwError = 0; log(L"Received command: %d <%s> <%s>", dwAction, ptszFile1, ptszFile2); @@ -108,7 +108,7 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) case 2: // move if (!DeleteFileW(ptszFile2)) { - DWORD err = GetLastError(); + uint32_t err = GetLastError(); if (err != ERROR_ACCESS_DENIED && err != ERROR_FILE_NOT_FOUND) { dwError = err; break; @@ -116,7 +116,7 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) } if (!MoveFileW(ptszFile1, ptszFile2)) { // use copy on error - switch (DWORD err = GetLastError()) { + switch (uint32_t err = GetLastError()) { case ERROR_ALREADY_EXISTS: case ERROR_FILE_NOT_FOUND: dwError = 0; @@ -164,7 +164,7 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) dwError = ERROR_UNKNOWN_FEATURE; } - WriteFile(hPipe, &dwError, sizeof(DWORD), &dwBytes, nullptr); + WriteFile(hPipe, &dwError, sizeof(uint32_t), &dwBytes, nullptr); } dwError = GetLastError(); diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index d93b3fc043..8dcbc35592 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -393,7 +393,7 @@ static void GetList(void *) Thread_SetName("PluginUpdater: GetList");
TFileName wszTempPath;
- DWORD dwLen = GetTempPath(_countof(wszTempPath), wszTempPath);
+ uint32_t dwLen = GetTempPath(_countof(wszTempPath), wszTempPath);
if (wszTempPath[dwLen - 1] == '\\')
wszTempPath[dwLen - 1] = 0;
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 02c40eaea6..baa2d0e90d 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -21,12 +21,12 @@ Boston, MA 02111-1307, USA. static bool bShowDetails;
static HWND hwndDialog;
-static DWORD dwCheckThreadId;
+static uint32_t dwCheckThreadId;
static HANDLE hTimer;
class CUpdateDLg : public CDlgBase
{
- DWORD dwThreadId = 0;
+ uint32_t dwThreadId = 0;
CCtrlButton btnDetails, btnSelAll, btnSelNone, btnOk;
CCtrlListView m_list;
OBJLIST<FILEINFO> *m_todo;
@@ -82,7 +82,7 @@ class CUpdateDLg : public CDlgBase Netlib_CloseHandle(nlc);
// 3) Unpack all zips
- DWORD dwErrorCode;
+ uint32_t dwErrorCode;
for (auto &it : todo) {
if (it->bEnabled) {
if (it->bDeleteOnly) {
@@ -432,7 +432,7 @@ static void DlgUpdateSilent(void *param) }
// 3) Unpack all zips
- DWORD dwErrorCode;
+ uint32_t dwErrorCode;
VARSW wszMirandaPath(L"%miranda_path%");
for (auto &it : UpdateFiles) {
if (it->bEnabled) {
@@ -805,7 +805,7 @@ static void CheckUpdates(void *) ThreadWatch threadId(dwCheckThreadId);
TFileName wszTempPath;
- DWORD dwLen = GetTempPath(_countof(wszTempPath), wszTempPath);
+ uint32_t dwLen = GetTempPath(_countof(wszTempPath), wszTempPath);
if (wszTempPath[dwLen - 1] == '\\')
wszTempPath[dwLen - 1] = 0;
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 9d9879d607..129f66e0ec 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -90,7 +90,7 @@ int CMPlugin::Load() g_plugin.setByte(DB_SETTING_NEED_RESTART, 0);
- DWORD dwLen = GetTempPath(_countof(g_wszTempPath), g_wszTempPath);
+ uint32_t dwLen = GetTempPath(_countof(g_wszTempPath), g_wszTempPath);
if (g_wszTempPath[dwLen-1] == '\\')
g_wszTempPath[dwLen-1] = 0;
diff --git a/plugins/PluginUpdater/src/checksum.cpp b/plugins/PluginUpdater/src/checksum.cpp index 39beb73c49..217bdb579f 100644 --- a/plugins/PluginUpdater/src/checksum.cpp +++ b/plugins/PluginUpdater/src/checksum.cpp @@ -71,7 +71,7 @@ static void PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY pIRD, uint8_t *pBa PatchResourceEntry(pIRDE, pBase);
}
-__forceinline bool Contains(PIMAGE_SECTION_HEADER pISH, DWORD address, DWORD size = 0)
+__forceinline bool Contains(PIMAGE_SECTION_HEADER pISH, uint32_t address, uint32_t size = 0)
{
return (address >= pISH->VirtualAddress && address + size <= pISH->VirtualAddress + pISH->SizeOfRawData);
}
@@ -110,7 +110,7 @@ LBL_NotPE: goto LBL_NotPE;
uint16_t machine = pINTH->FileHeader.Machine;
- DWORD sections = pINTH->FileHeader.NumberOfSections;
+ uint32_t sections = pINTH->FileHeader.NumberOfSections;
if (!sections)
return RESULT_INVALID;
@@ -120,13 +120,13 @@ LBL_NotPE: ULONGLONG base = 0;
// try to found correct offset independent of architectures
- DWORD offset = pIDH->e_lfanew + pINTH->FileHeader.SizeOfOptionalHeader + sizeof(IMAGE_NT_HEADERS) - sizeof(IMAGE_OPTIONAL_HEADER);
+ uint32_t offset = pIDH->e_lfanew + pINTH->FileHeader.SizeOfOptionalHeader + sizeof(IMAGE_NT_HEADERS) - sizeof(IMAGE_OPTIONAL_HEADER);
if ((machine == IMAGE_FILE_MACHINE_I386) &&
(pINTH->FileHeader.SizeOfOptionalHeader >= sizeof(IMAGE_OPTIONAL_HEADER32)) &&
(pINTH->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)) {
pIDD = (PIMAGE_DATA_DIRECTORY)((uint8_t*)pINTH + offsetof(IMAGE_NT_HEADERS32, OptionalHeader.DataDirectory));
- base = *(DWORD*)((uint8_t*)pINTH + offsetof(IMAGE_NT_HEADERS32, OptionalHeader.ImageBase));
+ base = *(uint32_t*)((uint8_t*)pINTH + offsetof(IMAGE_NT_HEADERS32, OptionalHeader.ImageBase));
}
else if ((machine == IMAGE_FILE_MACHINE_AMD64) &&
(pINTH->FileHeader.SizeOfOptionalHeader >= sizeof(IMAGE_OPTIONAL_HEADER64)) &&
@@ -137,30 +137,30 @@ LBL_NotPE: else return RESULT_CORRUPTED;
// Debugging information entry
- DWORD dbgAddr = pIDD[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
- DWORD dbgSize = pIDD[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
+ uint32_t dbgAddr = pIDD[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+ uint32_t dbgSize = pIDD[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
// Export information entry
- DWORD expAddr = pIDD[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
- DWORD expSize = pIDD[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
+ uint32_t expAddr = pIDD[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ uint32_t expSize = pIDD[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
// Resource directory
- DWORD resAddr = pIDD[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
- DWORD resSize = pIDD[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size;
+ uint32_t resAddr = pIDD[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
+ uint32_t resSize = pIDD[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size;
// Reallocation information entry
- DWORD relocAddr = pIDD[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
- DWORD relocSize = pIDD[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
+ uint32_t relocAddr = pIDD[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
+ uint32_t relocSize = pIDD[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
// verify image integrity
- for (DWORD idx = 0; idx < sections; idx++) {
+ for (uint32_t idx = 0; idx < sections; idx++) {
PIMAGE_SECTION_HEADER pISH = (PIMAGE_SECTION_HEADER)(map.ptr + offset + idx * sizeof(IMAGE_SECTION_HEADER));
if (((uint8_t*)pISH + sizeof(IMAGE_SECTION_HEADER) > map.ptr + filesize) || (pISH->PointerToRawData + pISH->SizeOfRawData > filesize))
return RESULT_CORRUPTED;
// erase timestamp
if (dbgSize >= sizeof(IMAGE_DEBUG_DIRECTORY) && Contains(pISH, dbgAddr, dbgSize)) {
- DWORD shift = dbgAddr - pISH->VirtualAddress;
+ uint32_t shift = dbgAddr - pISH->VirtualAddress;
pDBG = (PIMAGE_DEBUG_DIRECTORY)(map.ptr + shift + pISH->PointerToRawData);
for (int i = dbgSize / sizeof(IMAGE_DEBUG_DIRECTORY); i > 0; i--)
pDBG[i - 1].TimeDateStamp = 0;
@@ -168,14 +168,14 @@ LBL_NotPE: // erase export timestamp
if (expSize >= sizeof(IMAGE_EXPORT_DIRECTORY) && Contains(pISH, expAddr, expSize)) {
- DWORD shift = expAddr - pISH->VirtualAddress;
+ uint32_t shift = expAddr - pISH->VirtualAddress;
PIMAGE_EXPORT_DIRECTORY pEXP = (PIMAGE_EXPORT_DIRECTORY)(map.ptr + shift + pISH->PointerToRawData);
pEXP->TimeDateStamp = 0;
}
// find realocation table
if ((relocSize >= sizeof(IMAGE_BASE_RELOCATION)) && Contains(pISH, relocAddr, relocSize)) {
- DWORD shift = relocAddr - pISH->VirtualAddress;
+ uint32_t shift = relocAddr - pISH->VirtualAddress;
pRealloc = map.ptr + shift + pISH->PointerToRawData;
}
}
@@ -193,33 +193,33 @@ LBL_NotPE: // patch resources
if (resSize > 0 && Contains(pISH, resAddr, resSize)) {
- DWORD shift = resAddr - pISH->VirtualAddress + pISH->PointerToRawData;
+ uint32_t shift = resAddr - pISH->VirtualAddress + pISH->PointerToRawData;
IMAGE_RESOURCE_DIRECTORY *pIRD = (IMAGE_RESOURCE_DIRECTORY*)(map.ptr + shift);
PatchResourcesDirectory(pIRD, map.ptr + shift);
}
// rebase to zero address
if (pRealloc) {
- DWORD blocklen = relocSize;
+ uint32_t blocklen = relocSize;
PIMAGE_BASE_RELOCATION pIBR = (PIMAGE_BASE_RELOCATION)pRealloc;
while (pIBR) {
if (Contains(pISH, pIBR->VirtualAddress) && pIBR->SizeOfBlock <= blocklen) {
- DWORD shift = pIBR->VirtualAddress - pISH->VirtualAddress + pISH->PointerToRawData;
+ uint32_t shift = pIBR->VirtualAddress - pISH->VirtualAddress + pISH->PointerToRawData;
int len = pIBR->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION);
PWORD pw = (PWORD)((uint8_t*)pIBR + sizeof(IMAGE_BASE_RELOCATION));
while (len > 0) {
- DWORD type = *pw >> 12;
- DWORD addr = (*pw & 0x0FFF);
+ uint32_t type = *pw >> 12;
+ uint32_t addr = (*pw & 0x0FFF);
uint8_t *pAddr = map.ptr + shift + addr;
switch (type) {
case IMAGE_REL_BASED_HIGHLOW:
- if (addr + pIBR->VirtualAddress + sizeof(DWORD) >= pISH->VirtualAddress + pISH->SizeOfRawData) {
+ if (addr + pIBR->VirtualAddress + sizeof(uint32_t) >= pISH->VirtualAddress + pISH->SizeOfRawData) {
len = 0;
break;
}
- *(PDWORD)pAddr = (DWORD)((*(PDWORD)pAddr) - (DWORD)base);
+ *(PDWORD)pAddr = (uint32_t)((*(PDWORD)pAddr) - (uint32_t)base);
break;
case IMAGE_REL_BASED_DIR64:
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index f4a4416b73..b28a96ed02 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -149,7 +149,7 @@ enum using namespace std;
-extern DWORD g_mirandaVersion;
+extern uint32_t g_mirandaVersion;
extern wchar_t g_wszRoot[MAX_PATH], g_wszTempPath[MAX_PATH];
extern HNETLIBUSER g_hNetlibUser;
@@ -182,11 +182,11 @@ struct CMPlugin : public PLUGIN<CMPlugin> // common options
CMOption<bool> bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bSilentMode, bBackup, bChangePlatform, bUseHttps, bAutoRestart;
CMOption<int> iPeriod, iPeriodMeasure, iNumberBackups;
- CMOption<DWORD> dwLastUpdate;
+ CMOption<uint32_t> dwLastUpdate;
// popup options
CMOption<uint8_t> PopupDefColors, PopupLeftClickAction, PopupRightClickAction;
- CMOption<DWORD> PopupTimeout;
+ CMOption<uint32_t> PopupTimeout;
};
void DoCheck(bool bSilent = true);
@@ -195,10 +195,10 @@ void UninitListNew(void); class ThreadWatch
{
- DWORD &pId;
+ uint32_t &pId;
public:
- ThreadWatch(DWORD &_1) :
+ ThreadWatch(uint32_t &_1) :
pId(_1)
{
pId = ::GetCurrentThreadId();
@@ -227,7 +227,7 @@ struct ServListEntry }
wchar_t *m_name;
- DWORD m_crc;
+ uint32_t m_crc;
char m_szHash[32+1];
};
|