void VDUIListViewW32::AddColumn(const wchar_t *name, int width, int affinity) { VDASSERT(affinity >= 0); VDASSERT(width >= 0); if (VDIsWindowsNT()) { LVCOLUMNW lvcw={0}; lvcw.mask = LVCF_TEXT | LVCF_WIDTH; lvcw.pszText = (LPWSTR)name; lvcw.cx = width; SendMessageW(mhwnd, LVM_INSERTCOLUMNW, mColumns.size(), (LPARAM)&lvcw); } else { LVCOLUMNA lvca={0}; VDStringA nameA(VDTextWToA(name)); lvca.mask = LVCF_TEXT | LVCF_WIDTH; lvca.pszText = (LPSTR)nameA.c_str(); lvca.cx = width; SendMessageA(mhwnd, LVM_INSERTCOLUMNA, mColumns.size(), (LPARAM)&lvca); } mColumns.push_back(Column()); Column& col = mColumns.back(); col.mWidth = width; col.mAffinity = affinity; mTotalWidth += width; mTotalAffinity += affinity; OnResize(); }
static void GetModules(str::Str<char>& s) { HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId()); if (snap == INVALID_HANDLE_VALUE) return; MODULEENTRY32 mod; mod.dwSize = sizeof(mod); BOOL cont = Module32First(snap, &mod); while (cont) { ScopedMem<char> nameA(str::conv::ToUtf8(mod.szModule)); ScopedMem<char> pathA(str::conv::ToUtf8(mod.szExePath)); s.AppendFmt("Module: %08X %06X %-16s %s\r\n", (DWORD)mod.modBaseAddr, (DWORD)mod.modBaseSize, nameA, pathA); cont = Module32Next(snap, &mod); } CloseHandle(snap); }
// returns true if running on wine (winex11.drv is present) // it's not a logical, but convenient place to do it static bool GetModules(str::Str<char>& s) { bool isWine = false; HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId()); if (snap == INVALID_HANDLE_VALUE) return true; MODULEENTRY32 mod; mod.dwSize = sizeof(mod); BOOL cont = Module32First(snap, &mod); while (cont) { ScopedMem<char> nameA(str::conv::ToUtf8(mod.szModule)); if (str::EqI(nameA.Get(), "winex11.drv")) isWine = true; ScopedMem<char> pathA(str::conv::ToUtf8(mod.szExePath)); s.AppendFmt("Module: %p %06X %-16s %s\r\n", mod.modBaseAddr, mod.modBaseSize, nameA.Get(), pathA.Get()); cont = Module32Next(snap, &mod); } CloseHandle(snap); return isWine; }