Fix some win32 definitions

You can now use psapi.dll and pdh.dll. Some TODOs for Windows have been
cleared out. We might have a working load average for the platform that
should help GNU Make work well.
This commit is contained in:
Justine Tunney 2022-03-22 19:51:27 -07:00
parent e2e0b042c1
commit c23b6ecc31
162 changed files with 847 additions and 153 deletions

View file

@ -276,6 +276,9 @@ COSMOPOLITAN_OBJECTS = \
LIBC_CALLS \
LIBC_RAND \
LIBC_SYSV_CALLS \
LIBC_NT_PSAPI \
LIBC_NT_POWERPROF \
LIBC_NT_PDH \
LIBC_NT_KERNELBASE \
LIBC_NT_SHELL32 \
LIBC_NT_GDI32 \

View file

@ -10,6 +10,7 @@
#include "libc/calls/calls.h"
#include "libc/log/check.h"
#include "libc/stdio/stdio.h"
#include "libc/time/time.h"
int main(int argc, char *argv[]) {
double x[3];

View file

@ -44,6 +44,8 @@ LIBC_CALLS_A_DIRECTDEPS = \
LIBC_NT_IPHLPAPI \
LIBC_NT_KERNEL32 \
LIBC_NT_NTDLL \
LIBC_NT_PDH \
LIBC_NT_PSAPI \
LIBC_NT_POWERPROF \
LIBC_NT_WS2_32 \
LIBC_STR \

View file

@ -31,7 +31,6 @@ int getloadavg(double *a, int n) {
struct sysinfo si;
if (!n) return 0;
if (n < 0) return einval();
if (IsWindows()) return enosys(); /* TODO(jart) */
if (sysinfo(&si) == -1) return -1;
if (n > 3) n = 3;
for (i = 0; i < n; i++) {

View file

@ -21,7 +21,9 @@
#include "libc/calls/struct/rusage.h"
#include "libc/fmt/conv.h"
#include "libc/nt/accounting.h"
#include "libc/nt/process.h"
#include "libc/nt/runtime.h"
#include "libc/nt/struct/processmemorycounters.h"
#include "libc/nt/thread.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/rusage.h"
@ -32,6 +34,7 @@ textwindows int sys_getrusage_nt(int who, struct rusage *usage) {
struct NtFileTime ExitFileTime;
struct NtFileTime KernelFileTime;
struct NtFileTime UserFileTime;
struct NtProcessMemoryCountersEx memcount;
if (!usage) return efault();
if (who == 99) return enosys(); /* @see libc/sysv/consts.sh */
bzero(usage, sizeof(*usage));
@ -40,8 +43,14 @@ textwindows int sys_getrusage_nt(int who, struct rusage *usage) {
&CreationFileTime, &ExitFileTime, &KernelFileTime, &UserFileTime)) {
usage->ru_utime = FileTimeToTimeVal(UserFileTime);
usage->ru_stime = FileTimeToTimeVal(KernelFileTime);
return 0;
} else {
return __winerr();
}
if (GetProcessMemoryInfo(GetCurrentProcess(), &memcount, sizeof(memcount))) {
usage->ru_maxrss = memcount.PeakWorkingSetSize;
usage->ru_majflt = memcount.PageFaultCount;
} else {
return __winerr();
}
return 0;
}

View file

@ -29,8 +29,7 @@
* @vforksafe
*/
bool isexecutable(const char *path) {
/* execve() depends on this */
struct stat st;
struct stat st; /* execve() depends on this */
if (fstatat(AT_FDCWD, path, &st, 0)) return 0;
return !!(st.st_mode & 0111);
return !S_ISDIR(st.st_mode) && !!(st.st_mode & 0111);
}

View file

@ -23,24 +23,34 @@
#include "libc/nt/console.h"
#include "libc/nt/enum/ctrlevent.h"
#include "libc/nt/enum/processaccess.h"
#include "libc/nt/errors.h"
#include "libc/nt/process.h"
#include "libc/nt/runtime.h"
#include "libc/sysv/errfuns.h"
textwindows int sys_kill_nt(int pid, int sig) {
bool ok;
int event;
int64_t handle;
int event, ntpid;
if (pid) {
pid = ABS(pid);
if ((event = GetConsoleCtrlEvent(sig)) != -1) {
ok = !!GenerateConsoleCtrlEvent(
event, __isfdkind(pid, kFdProcess) ? GetProcessId(g_fds.p[pid].handle)
: pid);
/* kill(pid, SIGINT|SIGHUP|SIGQUIT) */
if (__isfdkind(pid, kFdProcess)) {
ntpid = GetProcessId(g_fds.p[pid].handle);
} else if (!__isfdopen(pid)) {
/* XXX: this is sloppy (see fork-nt.c) */
ntpid = pid;
} else {
return esrch();
}
ok = !!GenerateConsoleCtrlEvent(event, ntpid);
} else if (__isfdkind(pid, kFdProcess)) {
ok = !!TerminateProcess(g_fds.p[pid].handle, 128 + sig);
} else if ((handle = OpenProcess(kNtProcessAllAccess, false, pid))) {
if (!ok && GetLastError() == kNtErrorAccessDenied) ok = true;
} else if ((handle = OpenProcess(kNtProcessTerminate, false, pid))) {
ok = !!TerminateProcess(handle, 128 + sig);
if (!ok && GetLastError() == kNtErrorAccessDenied) ok = true;
CloseHandle(handle);
} else {
ok = false;

95
libc/calls/loadavg-nt.c Normal file
View file

@ -0,0 +1,95 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/loadavg.internal.h"
#include "libc/calls/strace.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/nexgen32e/nt2sysv.h"
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/pdh.h"
#include "libc/nt/enum/securityimpersonationlevel.h"
#include "libc/nt/enum/wt.h"
#include "libc/nt/errors.h"
#include "libc/nt/events.h"
#include "libc/nt/files.h"
#include "libc/nt/pdh.h"
#include "libc/nt/privilege.h"
#include "libc/nt/runtime.h"
#include "libc/nt/struct/luid.h"
#include "libc/nt/struct/pdhfmtcountervalue.h"
#include "libc/nt/struct/tokenprivileges.h"
#include "libc/nt/synchronization.h"
#include "libc/str/str.h"
/**
* @fileoverview sysinfo() on the new technology
* @kudos Giampaolo Rodola for teaching how to do load average
*/
#define LOAD_SAMPLING_INTERVAL 1 // in seconds
// https://github.com/torvalds/linux/blob/345671ea0f9258f410eb057b9ced9cefbbe5dc78/include/linux/sched/loadavg.h#L20-L23
#define LOAD1F .9200444146293232478931553241
#define LOAD5F .9834714538216174894737477501
#define LOAD15F .9944598480048967508795473394
double __ntloadavg[3];
static void LoadavgNtPoll(int64_t hCounter, bool32 timedOut) {
struct NtPdhFmtCountervalue c;
if (!PdhGetFormattedCounterValue(hCounter, kNtPdhFmtDouble, 0, &c)) {
__ntloadavg[0] = __ntloadavg[0] * LOAD1F + c.doubleValue * (1 - LOAD1F);
__ntloadavg[1] = __ntloadavg[1] * LOAD5F + c.doubleValue * (1 - LOAD5F);
__ntloadavg[2] = __ntloadavg[2] * LOAD15F + c.doubleValue * (1 - LOAD15F);
} else {
STRACE("PdhGetFormattedCounterValue(%ld) failed", hCounter);
}
}
static textstartup void LoadavgNtInit(void) {
int64_t hQuery, hCounter, hEvent, hWaiter;
if (!IsWindows()) return;
STRACE("LoadavgNtInit()");
if (PdhOpenQuery(0, 0, &hQuery)) {
STRACE("PdhOpenQuery failed");
return;
}
if (PdhAddEnglishCounter(hQuery, u"\\System\\Processor Queue Length", 0,
&hCounter)) {
STRACE("PdhAddEnglishCounter() failed");
return;
}
if (!(hEvent = CreateEvent(0, 0, 0, u"LoadUpdateEvent"))) {
STRACE("CreateEvent() failed");
return;
}
if (PdhCollectQueryDataEx(hQuery, LOAD_SAMPLING_INTERVAL, hEvent)) {
STRACE("PdhCollectQueryDataEx() failed");
return;
}
if (!RegisterWaitForSingleObject(
&hWaiter, hEvent, (void *)NT2SYSV(LoadavgNtPoll),
(void *)(intptr_t)hCounter, -1, kNtWtExecutedefault)) {
STRACE("RegisterWaitForSingleObject() failed");
return;
}
LoadavgNtPoll(hCounter, 0);
}
const void *const LoadavgNtCtor[] initarray = {LoadavgNtInit};

View file

@ -0,0 +1,10 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_LOADAVG_INTERNAL_H_
#define COSMOPOLITAN_LIBC_CALLS_LOADAVG_INTERNAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern double __ntloadavg[3];
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_LOADAVG_INTERNAL_H_ */

92
libc/calls/sedebug.c Normal file
View file

@ -0,0 +1,92 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h"
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/securityimpersonationlevel.h"
#include "libc/nt/errors.h"
#include "libc/nt/files.h"
#include "libc/nt/privilege.h"
#include "libc/nt/runtime.h"
#include "libc/nt/struct/luid.h"
#include "libc/nt/struct/tokenprivileges.h"
static bool32 SetPrivilegeNt(int64_t hToken, const char16_t *lpwPrivilege,
bool32 bEnable) {
struct NtLuid luid;
uint32_t cbPrevious;
struct NtTokenPrivileges tp, tpPrevious;
cbPrevious = sizeof(struct NtTokenPrivileges);
if (!LookupPrivilegeValue(0, lpwPrivilege, &luid)) {
STRACE("LookupPrivilegeValue() failed");
return false;
}
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
tp.Privileges[0].Attributes = 0;
if (!AdjustTokenPrivileges(hToken, false, &tp, sizeof(tp), &tpPrevious,
&cbPrevious)) {
STRACE("AdjustTokenPrivileges() failed");
return false;
}
tpPrevious.PrivilegeCount = 1;
tpPrevious.Privileges[0].Luid = luid;
if (bEnable) {
tpPrevious.Privileges[0].Attributes |= kNtSePrivilegeEnabled;
} else {
tpPrevious.Privileges[0].Attributes ^=
kNtSePrivilegeEnabled & tpPrevious.Privileges[0].Attributes;
}
if (!AdjustTokenPrivileges(hToken, false, &tpPrevious, cbPrevious, 0, 0)) {
STRACE("AdjustTokenPrivileges() failed");
return false;
}
return true;
}
static int64_t GetCurrentProcessSecurityToken(void) {
int64_t hToken;
if (OpenProcessToken(GetCurrentProcess(),
kNtTokenAdjustPrivileges | kNtTokenQuery, &hToken)) {
return hToken;
} else if (GetLastError() == kNtErrorNoToken) {
if (ImpersonateSelf(kNtSecurityImpersonation)) {
if (OpenProcessToken(GetCurrentProcess(),
kNtTokenAdjustPrivileges | kNtTokenQuery, &hToken)) {
return hToken;
} else {
STRACE("OpenProcessToken() failed");
}
} else {
STRACE("ImpersonateSelf() failed");
}
} else {
STRACE("OpenProcessToken() failed");
}
return 0;
}
bool32 ElevateSeDebugPrivilege(void) {
int64_t hToken;
if (!(hToken = GetCurrentProcessSecurityToken())) return false;
SetPrivilegeNt(hToken, u"SeDebugPrivilege", true);
RevertToSelf();
CloseHandle(hToken);
return true;
}

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/internal.h"
#include "libc/calls/loadavg.internal.h"
#include "libc/calls/struct/sysinfo.h"
#include "libc/nt/accounting.h"
#include "libc/nt/struct/memorystatusex.h"
@ -32,6 +33,9 @@ textwindows int sys_sysinfo_nt(struct sysinfo *info) {
info->totalram = memstat.ullTotalPhys;
info->freeram = memstat.ullAvailPhys;
info->procs = sysinfo.dwNumberOfProcessors;
info->loads[0] = __ntloadavg[0] * 65536;
info->loads[1] = __ntloadavg[1] * 65536;
info->loads[2] = __ntloadavg[2] * 65536;
info->mem_unit = 1;
return 0;
} else {

View file

@ -47,8 +47,10 @@ int sysinfo(struct sysinfo *info) {
} else {
rc = sys_sysinfo_nt(info);
}
info->procs = MAX(1, info->procs);
info->mem_unit = MAX(1, info->mem_unit);
info->totalram = MAX((8 * 1024 * 1024) / info->mem_unit, info->totalram);
if (rc != -1) {
info->procs = MAX(1, info->procs);
info->mem_unit = MAX(1, info->mem_unit);
info->totalram = MAX((8 * 1024 * 1024) / info->mem_unit, info->totalram);
}
return rc;
}

View file

@ -24,26 +24,47 @@
#include "libc/fmt/conv.h"
#include "libc/macros.internal.h"
#include "libc/nt/accounting.h"
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/processaccess.h"
#include "libc/nt/enum/status.h"
#include "libc/nt/enum/wait.h"
#include "libc/nt/process.h"
#include "libc/nt/runtime.h"
#include "libc/nt/struct/filetime.h"
#include "libc/nt/struct/processmemorycounters.h"
#include "libc/nt/synchronization.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/w.h"
#include "libc/sysv/errfuns.h"
textwindows int sys_wait4_nt(int pid, int *opt_out_wstatus, int options,
struct rusage *opt_out_rusage) {
int pids[64];
int64_t handle;
int64_t handles[64];
uint32_t dwExitCode;
uint32_t i, count, timeout;
struct NtProcessMemoryCountersEx memcount;
struct NtFileTime createfiletime, exitfiletime, kernelfiletime, userfiletime;
if (pid != -1) {
if (!__isfdkind(pid, kFdProcess)) {
return echild();
/* XXX: this is sloppy (see fork-nt.c) */
if (!__isfdopen(pid) &&
(handle = OpenProcess(kNtSynchronize | kNtProcessQueryInformation,
true, pid))) {
if ((pid = __reservefd()) != -1) {
g_fds.p[pid].kind = kFdProcess;
g_fds.p[pid].handle = handle;
g_fds.p[pid].flags = O_CLOEXEC;
} else {
CloseHandle(handle);
return echild();
}
} else {
return echild();
}
}
handles[0] = g_fds.p[pid].handle;
pids[0] = pid;
@ -74,7 +95,6 @@ textwindows int sys_wait4_nt(int pid, int *opt_out_wstatus, int options,
STRACE("%s failed %u", "WaitForMultipleObjects", GetLastError());
return __winerr();
}
assert(__isfdkind(pids[i], kFdProcess));
if (!GetExitCodeProcess(handles[i], &dwExitCode)) {
STRACE("%s failed %u", "GetExitCodeProcess", GetLastError());
return __winerr();
@ -85,8 +105,14 @@ textwindows int sys_wait4_nt(int pid, int *opt_out_wstatus, int options,
}
if (opt_out_rusage) {
bzero(opt_out_rusage, sizeof(*opt_out_rusage));
if (GetProcessTimes(g_fds.p[pids[i]].handle, &createfiletime,
&exitfiletime, &kernelfiletime, &userfiletime)) {
if (GetProcessMemoryInfo(handles[i], &memcount, sizeof(memcount))) {
opt_out_rusage->ru_maxrss = memcount.PeakWorkingSetSize;
opt_out_rusage->ru_majflt = memcount.PageFaultCount;
} else {
STRACE("%s failed %u", "GetProcessMemoryInfo", GetLastError());
}
if (GetProcessTimes(handles[i], &createfiletime, &exitfiletime,
&kernelfiletime, &userfiletime)) {
opt_out_rusage->ru_utime =
WindowsDurationToTimeVal(ReadFileTime(userfiletime));
opt_out_rusage->ru_stime =
@ -95,8 +121,8 @@ textwindows int sys_wait4_nt(int pid, int *opt_out_wstatus, int options,
STRACE("%s failed %u", "GetProcessTimes", GetLastError());
}
}
CloseHandle(g_fds.p[pids[i]].handle);
g_fds.p[pids[i]].kind = kFdEmpty;
CloseHandle(handles[i]);
__releasefd(pids[i]);
return pids[i];
}
}

View file

@ -250,6 +250,12 @@
#define HUMPD int64_t
#define HWND int64_t
#define PDH_FUNCTION LONG
#define PDH_HCOUNTER HANDLE
#define PDH_HQUERY HANDLE
#define PDH_HLOG HANDLE
#define ADDRESS_FAMILY uint16_t
#define TUNNEL_TYPE uint32_t
#define NET_IF_CONNECTION_TYPE uint32_t
@ -440,6 +446,9 @@
#define _FILE_FULL_EA_INFORMATION NtFileFullEaInformation
#define FILE_FULL_EA_INFORMATION struct NtFileFullEaInformation
#define PFILE_FULL_EA_INFORMATION struct NtFileFullEaInformation*
#define _PDH_FMT_COUNTERVALUE NtPdhFmtCountervalue
#define PDH_FMT_COUNTERVALUE struct NtPdhFmtCountervalue
#define PPDH_FMT_COUNTERVALUE struct NtPdhFmtCountervalue*
#define _LUID NtLuid
#define LUID struct NtLuid

View file

@ -22,6 +22,7 @@
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
#include "libc/calls/sigbits.h"
#include "libc/calls/strace.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
@ -170,15 +171,28 @@ static int PrintBacktrace(int fd, const struct StackFrame *bp) {
void ShowBacktrace(int fd, const struct StackFrame *bp) {
#ifdef __FNO_OMIT_FRAME_POINTER__
/* asan runtime depends on this function */
int st, ft;
static bool noreentry;
++g_ftrace;
if (!bp) bp = __builtin_frame_address(0);
if (!noreentry) {
noreentry = true;
st = __strace;
__strace = 0;
ft = g_ftrace;
g_ftrace = 0;
if (!bp) {
bp = __builtin_frame_address(0);
}
PrintBacktrace(fd, bp);
__strace = st;
g_ftrace = ft;
noreentry = false;
}
--g_ftrace;
#else
kprintf("ShowBacktrace() needs these flags to show C backtrace:%n"
"\t-D__FNO_OMIT_FRAME_POINTER__%n"

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_EmptyWorkingSet,EmptyWorkingSet,287

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_EnumDeviceDrivers,EnumDeviceDrivers,300

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_EnumPageFilesA,EnumPageFilesA,303

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_EnumPageFilesW,EnumPageFilesW,304

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_EnumProcessModules,EnumProcessModules,305

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_EnumProcessModulesEx,EnumProcessModulesEx,306

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_EnumProcesses,EnumProcesses,307

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetDeviceDriverBaseNameA,GetDeviceDriverBaseNameA,511

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetDeviceDriverBaseNameW,GetDeviceDriverBaseNameW,512

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetDeviceDriverFileNameA,GetDeviceDriverFileNameA,513

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetDeviceDriverFileNameW,GetDeviceDriverFileNameW,514

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetMappedFileNameA,GetMappedFileNameA,594

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetMappedFileNameW,GetMappedFileNameW,595

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetModuleBaseNameA,GetModuleBaseNameA,597

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetModuleBaseNameW,GetModuleBaseNameW,598

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetModuleFileNameExA,GetModuleFileNameExA,600

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetModuleFileNameExW,GetModuleFileNameExW,601

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetModuleInformation,GetModuleInformation,607

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetPerformanceInfo,GetPerformanceInfo,659

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetProcessMemoryInfo,GetProcessMemoryInfo,679

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetWsChanges,GetWsChanges,817

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetWsChangesEx,GetWsChangesEx,818

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_InitializeProcessForWsWatch,InitializeProcessForWsWatch,860

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_QueryWorkingSet,QueryWorkingSet,1280

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_QueryWorkingSetEx,QueryWorkingSetEx,1281

View file

@ -1,2 +1,15 @@
.include "o/libc/nt/codegen.inc"
.imp advapi32,__imp_ImpersonateSelf,ImpersonateSelf,0
.text.windows
ImpersonateSelf:
push %rbp
mov %rsp,%rbp
.profilable
mov %rdi,%rcx
sub $32,%rsp
call *__imp_ImpersonateSelf(%rip)
leave
ret
.endfn ImpersonateSelf,globl
.previous

View file

@ -1,2 +1,14 @@
.include "o/libc/nt/codegen.inc"
.imp advapi32,__imp_RevertToSelf,RevertToSelf,0
.text.windows
RevertToSelf:
push %rbp
mov %rsp,%rbp
.profilable
sub $32,%rsp
call *__imp_RevertToSelf(%rip)
leave
ret
.endfn RevertToSelf,globl
.previous

17
libc/nt/enum/pdh.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_PDH_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_PDH_H_
#define kNtPdhFmtRaw 0x00000010u
#define kNtPdhFmtAnsi 0x00000020u
#define kNtPdhFmtUnicode 0x00000040u
#define kNtPdhFmtLong 0x00000100u
#define kNtPdhFmtDouble 0x00000200u
#define kNtPdhFmtLarge 0x00000400u
#define kNtPdhFmtNoscale 0x00001000u
#define kNtPdhFmt1000 0x00002000u
#define kNtPdhFmtNodata 0x00004000u
#define kNtPdhFmtNocap100 0x00008000u
#define kNtPerfDetailCostly 0x00010000u
#define kNtPerfDetailStandard 0x0000FFFFu
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_PDH_H_ */

View file

@ -1,10 +1,11 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_WT_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_WT_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define kNtWtExecuteonlyonce 8
#define kNtWtExecutedefault 0x00000000u
#define kNtWtExecuteonlyonce 0x00000008u
#define kNtWtExecuteintimerthread 0x00000020u
#define kNtWtExecuteinpersistentthread 0x00000080u
#define kNtWtExecutelongfunction 0x00000010u
#define kNtWtTransferImpersonation 0𝔵00000100𝔲
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_WT_H_ */

View file

@ -1,12 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_GetProcessImageFileNameA,GetProcessImageFileNameA,676
.text.windows
GetProcessImageFileNameA:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetProcessImageFileNameA(%rip),%rax
jmp __sysv2nt
.endfn GetProcessImageFileNameA,globl
.previous

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_K32GetModuleBaseNameA,K32GetModuleBaseNameA,0

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_K32GetModuleFileNameExA,K32GetModuleFileNameExA,0

View file

@ -1,2 +0,0 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_K32GetProcessImageFileNameA,K32GetProcessImageFileNameA,0

View file

@ -1,20 +1,5 @@
/usr/bin/env echo ' -*-mode:sh;indent-tabs-mode:nil;tab-width:8;coding:utf-8-*-│
│vi: set net ft=sh ts=2 sts=2 sw=2 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2020 Justine Alexandra Roberts Tunney │
│ │
│ Permission to use, copy, modify, and/or distribute this software for
│ any purpose with or without fee is hereby granted, provided that the │
│ above copyright notice and this permission notice appear in all copies. │
│ │
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚────────────────────────────────────────────────────────────────'>/dev/null #*/
. libc/nt/codegen.sh
@ -1355,7 +1340,6 @@ imp 'ElfReportEventAndSource' ElfReportEventAndSourceW advapi32 1263
imp 'ElfReportEvent' ElfReportEventW advapi32 1264
imp 'Ellipse' Ellipse gdi32 1395
imp 'EmptyClipboard' EmptyClipboard user32 1740
imp 'EmptyWorkingSet' EmptyWorkingSet KernelBase 287
imp 'EnableEUDC' EnableEUDC gdi32 1396
imp 'EnableMenuItem' EnableMenuItem user32 1741
imp 'EnableMouseInPointer' EnableMouseInPointer user32 1742
@ -1452,7 +1436,6 @@ imp 'EnumDependentServices' EnumDependentServicesW advapi32 1273
imp 'EnumDesktopWindows' EnumDesktopWindows user32 1757
imp 'EnumDesktopsA' EnumDesktopsA user32 1758
imp 'EnumDesktops' EnumDesktopsW user32 1759
imp 'EnumDeviceDrivers' EnumDeviceDrivers KernelBase 300
imp 'EnumDisplayDevicesA' EnumDisplayDevicesA user32 1760
imp 'EnumDisplayDevices' EnumDisplayDevicesW user32 1761
imp 'EnumDisplayMonitors' EnumDisplayMonitors user32 1762
@ -1474,11 +1457,6 @@ imp 'EnumLanguageGroupLocalesA' EnumLanguageGroupLocalesA kernel32 321
imp 'EnumLanguageGroupLocales' EnumLanguageGroupLocalesW kernel32 0 # KernelBase
imp 'EnumMetaFile' EnumMetaFile gdi32 1457
imp 'EnumObjects' EnumObjects gdi32 1458
imp 'EnumPageFilesA' EnumPageFilesA KernelBase 303
imp 'EnumPageFiles' EnumPageFilesW KernelBase 304
imp 'EnumProcessModules' EnumProcessModules KernelBase 305
imp 'EnumProcessModulesEx' EnumProcessModulesEx KernelBase 306
imp 'EnumProcesses' EnumProcesses KernelBase 307
imp 'EnumPropsA' EnumPropsA user32 1767
imp 'EnumPropsExA' EnumPropsExA user32 1768
imp 'EnumPropsEx' EnumPropsExW user32 1769
@ -2074,10 +2052,6 @@ imp 'GetDefaultCommConfig' GetDefaultCommConfigW kernel32 554
imp 'GetDesktopID' GetDesktopID user32 1832
imp 'GetDesktopWindow' GetDesktopWindow user32 1833 0
imp 'GetDeviceCaps' GetDeviceCaps gdi32 1634
imp 'GetDeviceDriverBaseNameA' GetDeviceDriverBaseNameA KernelBase 511
imp 'GetDeviceDriverBaseName' GetDeviceDriverBaseNameW KernelBase 512
imp 'GetDeviceDriverFileNameA' GetDeviceDriverFileNameA KernelBase 513
imp 'GetDeviceDriverFileName' GetDeviceDriverFileNameW KernelBase 514
imp 'GetDeviceGammaRamp' GetDeviceGammaRamp gdi32 1635
imp 'GetDevicePowerState' GetDevicePowerState kernel32 555
imp 'GetDialogBaseUnits' GetDialogBaseUnits user32 1834
@ -2279,8 +2253,6 @@ imp 'GetMailslotInfo' GetMailslotInfo kernel32 626
imp 'GetManagedApplicationCategories' GetManagedApplicationCategories advapi32 1336
imp 'GetManagedApplications' GetManagedApplications advapi32 1337
imp 'GetMapMode' GetMapMode gdi32 1671
imp 'GetMappedFileNameA' GetMappedFileNameA KernelBase 594
imp 'GetMappedFileName' GetMappedFileNameW KernelBase 595
imp 'GetMaximumProcessorCount' GetMaximumProcessorCount kernel32 627 1 # Windows 7+
imp 'GetMaximumProcessorGroupCount' GetMaximumProcessorGroupCount kernel32 628
imp 'GetMemoryErrorHandlingCapabilities' GetMemoryErrorHandlingCapabilities kernel32 0 # KernelBase
@ -2308,17 +2280,12 @@ imp 'GetMetaFileBitsEx' GetMetaFileBitsEx gdi32 1673
imp 'GetMetaFile' GetMetaFileW gdi32 1674
imp 'GetMetaRgn' GetMetaRgn gdi32 1675
imp 'GetMiterLimit' GetMiterLimit gdi32 1676
imp 'GetModuleBaseNameA' GetModuleBaseNameA KernelBase 597
imp 'GetModuleBaseName' GetModuleBaseNameW KernelBase 598
imp 'GetModuleFileName' GetModuleFileNameW kernel32 0 3 # KernelBase
imp 'GetModuleFileNameA' GetModuleFileNameA kernel32 0 3 # KernelBase
imp 'GetModuleFileNameExA' GetModuleFileNameExA KernelBase 600
imp 'GetModuleFileNameEx' GetModuleFileNameExW KernelBase 601
imp 'GetModuleHandle' GetModuleHandleA kernel32 0 1 # KernelBase
imp 'GetModuleFileNameA' GetModuleFileNameA kernel32 0 3 # KernelBase
imp 'GetModuleHandleW' GetModuleHandleW kernel32 0 1 # KernelBase
imp 'GetModuleHandleExA' GetModuleHandleExA kernel32 0 3 # KernelBase
imp 'GetModuleHandleEx' GetModuleHandleExW kernel32 0 3 # KernelBase
imp 'GetModuleInformation' GetModuleInformation KernelBase 607
imp 'GetMonitorInfoA' GetMonitorInfoA user32 1900
imp 'GetMonitorInfo' GetMonitorInfoW user32 1901
imp 'GetMouseMovePointsEx' GetMouseMovePointsEx user32 1902
@ -2420,7 +2387,6 @@ imp 'GetPackagesByPackageFamily' GetPackagesByPackageFamily kernel32 0 #
imp 'GetPaletteEntries' GetPaletteEntries gdi32 1687
imp 'GetParent' GetParent user32 1906 1
imp 'GetPath' GetPath gdi32 1688
imp 'GetPerformanceInfo' GetPerformanceInfo KernelBase 659
imp 'GetPersistedFileLocation' GetPersistedFileLocationW KernelBase 660
imp 'GetPersistedRegistryLocation' GetPersistedRegistryLocationW KernelBase 661
imp 'GetPersistedRegistryValue' GetPersistedRegistryValueW KernelBase 662
@ -2479,11 +2445,8 @@ imp 'GetProcessHeap' GetProcessHeap kernel32 0 0 # KernelBase
imp 'GetProcessHeaps' GetProcessHeaps kernel32 0 2 # KernelBase
imp 'GetProcessId' GetProcessId kernel32 0 1 # KernelBase
imp 'GetProcessIdOfThread' GetProcessIdOfThread kernel32 0 1 # KernelBase
imp 'GetProcessImageFileNameA' GetProcessImageFileNameA kernel32 676 3
imp 'GetProcessImageFileName' GetProcessImageFileNameW kernel32 677 3
imp 'GetProcessInformation' GetProcessInformation kernel32 0 4 # KernelBase
imp 'GetProcessIoCounters' GetProcessIoCounters kernel32 701 2
imp 'GetProcessMemoryInfo' GetProcessMemoryInfo KernelBase 679
imp 'GetProcessMitigationPolicy' GetProcessMitigationPolicy kernel32 0 # KernelBase
imp 'GetProcessPreferredUILanguages' GetProcessPreferredUILanguages kernel32 0 # KernelBase
imp 'GetProcessPriorityBoost' GetProcessPriorityBoost kernel32 0 2 # KernelBase
@ -2778,8 +2741,6 @@ imp 'GetWindowsDirectory' GetWindowsDirectoryW kernel32 0 2 # KernelBase
imp 'GetWindowsDirectoryA' GetWindowsDirectoryA kernel32 0 2 # KernelBase
imp 'GetWorldTransform' GetWorldTransform gdi32 1733
imp 'GetWriteWatch' GetWriteWatch kernel32 0 # KernelBase
imp 'GetWsChanges' GetWsChanges KernelBase 817
imp 'GetWsChangesEx' GetWsChangesEx KernelBase 818
imp 'GetXStateFeaturesMask' GetXStateFeaturesMask kernel32 0 # KernelBase
imp 'GhostWindowFromHungWindow' GhostWindowFromHungWindow user32 2011
imp 'GlobalAddAtomA' GlobalAddAtomA kernel32 815
@ -2869,7 +2830,7 @@ imp 'ImpersonateAnonymousToken' ImpersonateAnonymousToken advapi32 0 # Ke
imp 'ImpersonateDdeClientWindow' ImpersonateDdeClientWindow user32 2023
imp 'ImpersonateLoggedOnUser' ImpersonateLoggedOnUser advapi32 0 # KernelBase
imp 'ImpersonateNamedPipeClient' ImpersonateNamedPipeClient advapi32 0 # KernelBase
imp 'ImpersonateSelf' ImpersonateSelf advapi32 0 # KernelBase
imp 'ImpersonateSelf' ImpersonateSelf advapi32 0 1 # KernelBase
imp 'InSendMessage' InSendMessage user32 2024
imp 'InSendMessageEx' InSendMessageEx user32 2025
imp 'IncrementPackageStatusVersion' IncrementPackageStatusVersion KernelBase 847
@ -2895,7 +2856,6 @@ imp 'InitializeLpkHooks' InitializeLpkHooks user32 2031
imp 'InitializePointerDeviceInjection' InitializePointerDeviceInjection user32 2032
imp 'InitializePointerDeviceInjectionEx' InitializePointerDeviceInjectionEx user32 2033
imp 'InitializeProcThreadAttributeList' InitializeProcThreadAttributeList kernel32 0 4 # KernelBase
imp 'InitializeProcessForWsWatch' InitializeProcessForWsWatch KernelBase 860
imp 'InitializeSecurityDescriptor' InitializeSecurityDescriptor advapi32 0 # KernelBase
imp 'InitializeSid' InitializeSid advapi32 0 # KernelBase
imp 'InitializeSynchronizationBarrier' InitializeSynchronizationBarrier kernel32 0 # KernelBase
@ -3062,13 +3022,10 @@ imp 'K32GetDeviceDriverFileNameA' K32GetDeviceDriverFileNameA kernel32 0
imp 'K32GetDeviceDriverFileName' K32GetDeviceDriverFileNameW kernel32 0 # KernelBase
imp 'K32GetMappedFileNameA' K32GetMappedFileNameA kernel32 0 # KernelBase
imp 'K32GetMappedFileName' K32GetMappedFileNameW kernel32 0 # KernelBase
imp 'K32GetModuleBaseNameA' K32GetModuleBaseNameA kernel32 0 # KernelBase
imp 'K32GetModuleBaseName' K32GetModuleBaseNameW kernel32 0 # KernelBase
imp 'K32GetModuleFileNameExA' K32GetModuleFileNameExA kernel32 0 # KernelBase
imp 'K32GetModuleFileNameEx' K32GetModuleFileNameExW kernel32 0 # KernelBase
imp 'K32GetModuleInformation' K32GetModuleInformation kernel32 0 # KernelBase
imp 'K32GetPerformanceInfo' K32GetPerformanceInfo kernel32 0 # KernelBase
imp 'K32GetProcessImageFileNameA' K32GetProcessImageFileNameA kernel32 0 # KernelBase
imp 'K32GetProcessImageFileName' K32GetProcessImageFileNameW kernel32 0 # KernelBase
imp 'K32GetProcessMemoryInfo' K32GetProcessMemoryInfo kernel32 0 # KernelBase
imp 'K32GetWsChanges' K32GetWsChanges kernel32 0 # KernelBase
@ -4447,8 +4404,6 @@ imp 'QueryUserServiceName' QueryUserServiceName advapi32 1598
imp 'QueryUserServiceNameForContext' QueryUserServiceNameForContext advapi32 1599
imp 'QueryUsersOnEncryptedFile' QueryUsersOnEncryptedFile advapi32 1600
imp 'QueryVirtualMemoryInformation' QueryVirtualMemoryInformation KernelBase 1279
imp 'QueryWorkingSet' QueryWorkingSet KernelBase 1280
imp 'QueryWorkingSetEx' QueryWorkingSetEx KernelBase 1281
imp 'QueueUserAPC' QueueUserAPC kernel32 0 # KernelBase
imp 'QueueUserWorkItem' QueueUserWorkItem kernel32 0 # KernelBase
imp 'QuirkGetData' QuirkGetData KernelBase 1284
@ -4759,7 +4714,7 @@ imp 'RestartDialogEx' RestartDialogEx shell32 730
imp 'RestoreDC' RestoreDC gdi32 1808 2
imp 'ResumeThread' ResumeThread kernel32 0 # KernelBase
imp 'ReuseDDElParam' ReuseDDElParam user32 2290
imp 'RevertToSelf' RevertToSelf advapi32 0 # KernelBase
imp 'RevertToSelf' RevertToSelf advapi32 0 0 # KernelBase
imp 'RoundRect' RoundRect gdi32 1809
imp 'RsopLoggingEnabledInternal' RsopLoggingEnabledInternal KernelBase 1419
imp 'RtlAbortRXact' RtlAbortRXact ntdll 676
@ -6360,7 +6315,6 @@ imp 'SetStateVersion' SetStateVersion KernelBase 1549
imp 'SetStdHandle' SetStdHandle kernel32 0 2 # KernelBase
imp 'SetStdHandleEx' SetStdHandleEx KernelBase 1551
imp 'SetStretchBltMode' SetStretchBltMode gdi32 1908
imp 'SetSuspendState' SetSuspendState PowerProf 0 3
imp 'SetSysColors' SetSysColors user32 2375
imp 'SetSysColorsTemp' SetSysColorsTemp user32 2376
imp 'SetSystemCursor' SetSystemCursor user32 2377
@ -7890,3 +7844,110 @@ imp 'SetPerTcpConnectionEStats' SetPerTcpConnectionEStats iphlpapi 0
imp 'SetTcpEntry' SetTcpEntry iphlpapi 0
imp 'UnenableRouter' UnenableRouter iphlpapi 0
imp 'UnregisterInterfaceTimestampConfigChange' UnregisterInterfaceTimestampConfigChange iphlpapi 0
imp 'SetSuspendState' SetSuspendState PowerProf 0 3
imp 'CounterPathCallBack' CounterPathCallBack pdh 0 # Applications implement the CounterPathCallBack function to process the counter path strings returned by the Browse dialog box.
imp 'LoadPerfCounterTextStrings' LoadPerfCounterTextStringsW pdh 0 # Loads onto the computer the performance objects and counters defined in the specified initialization file.
imp 'PdhAddCounter' PdhAddCounterW pdh 0 # Adds the specified counter to the query.
imp 'PdhAddEnglishCounter' PdhAddEnglishCounterW pdh 0 4 # Adds the specified language-neutral counter to the query.
imp 'PdhBindInputDataSource' PdhBindInputDataSourceW pdh 0 # Binds one or more binary log files together for reading log data.
imp 'PdhBrowseCounters' PdhBrowseCountersW pdh 0 # Displays a Browse Counters dialog box that the user can use to select one or more counters that they want to add to the query. To use handles to data sources, use the PdhBrowseCountersH function.
imp 'PdhBrowseCountersH' PdhBrowseCountersHW pdh 0 # Displays a Browse Counters dialog box that the user can use to select one or more counters that they want to add to the query. This function is identical to the PdhBrowseCounters function, except that it supports the use of handles to data sources.
imp 'PdhCalculateCounterFromRawValue' PdhCalculateCounterFromRawValue pdh 0 # Calculates the displayable value of two raw counter values.
imp 'PdhCloseLog' PdhCloseLog pdh 0 # Closes the specified log file.
imp 'PdhCloseQuery' PdhCloseQuery pdh 0 # Closes all counters contained in the specified query, closes all handles related to the query, and frees all memory associated with the query.
imp 'PdhCollectQueryData' PdhCollectQueryData pdh 0 # Collects the current raw data value for all counters in the specified query and updates the status code of each counter.
imp 'PdhCollectQueryDataEx' PdhCollectQueryDataEx pdh 0 3 # Uses a separate thread to collect the current raw data value for all counters in the specified query. The function then signals the application-defined event and waits the specified time interval before returning.
imp 'PdhCollectQueryDataWithTime' PdhCollectQueryDataWithTime pdh 0 # Collects the current raw data value for all counters in the specified query and updates the status code of each counter.
imp 'PdhComputeCounterStatistics' PdhComputeCounterStatistics pdh 0 # Computes statistics for a counter from an array of raw values.
imp 'PdhConnectMachine' PdhConnectMachineW pdh 0 # Connects to the specified computer.
imp 'PdhEnumLogSetNames' PdhEnumLogSetNamesW pdh 0 # Enumerates the names of the log sets within the DSN.
imp 'PdhEnumMachines' PdhEnumMachinesW pdh 0 # Returns a list of the computer names associated with counters in a log file.
imp 'PdhEnumMachinesH' PdhEnumMachinesHW pdh 0 # Returns a list of the computer names associated with counters in a log file.
imp 'PdhEnumObjectItems' PdhEnumObjectItemsW pdh 0 # Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file. To use handles to data sources, use the PdhEnumObjectItemsH function.
imp 'PdhEnumObjectItemsH' PdhEnumObjectItemsHW pdh 0 # Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file. This function is identical to the PdhEnumObjectItems function, except that it supports the use of handles to data sources.
imp 'PdhEnumObjects' PdhEnumObjectsW pdh 0 # Returns a list of objects available on the specified computer or in the specified log file. To use handles to data sources, use the PdhEnumObjectsH function.
imp 'PdhEnumObjectsH' PdhEnumObjectsHW pdh 0 # Returns a list of objects available on the specified computer or in the specified log file.This function is identical to PdhEnumObjects, except that it supports the use of handles to data sources.
imp 'PdhExpandCounterPath' PdhExpandCounterPathW pdh 0 # Examines the specified computer (or local computer if none is specified) for counters and instances of counters that match the wildcard strings in the counter path.
imp 'PdhExpandWildCardPath' PdhExpandWildCardPathW pdh 0 # Examines the specified computer or log file and returns those counter paths that match the given counter path which contains wildcard characters. To use handles to data sources, use the PdhExpandWildCardPathH function.
imp 'PdhExpandWildCardPathH' PdhExpandWildCardPathHW pdh 0 # Examines the specified computer or log file and returns those counter paths that match the given counter path which contains wildcard characters.This function is identical to the PdhExpandWildCardPath function, except that it supports the use of handles to data sources.
imp 'PdhFormatFromRawValue' PdhFormatFromRawValue pdh 0 # Computes a displayable value for the given raw counter values.
imp 'PdhGetCounterInfo' PdhGetCounterInfoW pdh 0 # Retrieves information about a counter, such as data size, counter type, path, and user-supplied data values.
imp 'PdhGetCounterTimeBase' PdhGetCounterTimeBase pdh 0 # Returns the time base of the specified counter.
imp 'PdhGetDataSourceTimeRange' PdhGetDataSourceTimeRangeW pdh 0 # Determines the time range, number of entries and, if applicable, the size of the buffer containing the performance data from the specified input source. To use handles to data sources, use the PdhGetDataSourceTimeRangeH function.
imp 'PdhGetDataSourceTimeRangeH' PdhGetDataSourceTimeRangeH pdh 0 # Determines the time range, number of entries and, if applicable, the size of the buffer containing the performance data from the specified input source.This function is identical to the PdhGetDataSourceTimeRange function, except that it supports the use of handles to data sources.
imp 'PdhGetDefaultPerfCounter' PdhGetDefaultPerfCounterW pdh 0 # Retrieves the name of the default counter for the specified object. This name can be used to set the initial counter selection in the Browse Counter dialog box. To use handles to data sources, use the PdhGetDefaultPerfCounterH function.
imp 'PdhGetDefaultPerfCounterH' PdhGetDefaultPerfCounterHW pdh 0 # Retrieves the name of the default counter for the specified object.
imp 'PdhGetDefaultPerfObject' PdhGetDefaultPerfObjectW pdh 0 # Retrieves the name of the default object. This name can be used to set the initial object selection in the Browse Counter dialog box. To use handles to data sources, use the PdhGetDefaultPerfObjectH function.
imp 'PdhGetDefaultPerfObjectH' PdhGetDefaultPerfObjectHW pdh 0 # Retrieves the name of the default object.
imp 'PdhGetDllVersion' PdhGetDllVersion pdh 0 # Returns the version of the currently installed Pdh.dll file.
imp 'PdhGetFormattedCounterArray' PdhGetFormattedCounterArrayW pdh 0 # Returns an array of formatted counter values. Use this function when you want to format the counter values of a counter that contains a wildcard character for the instance name.
imp 'PdhGetFormattedCounterValue' PdhGetFormattedCounterValue pdh 0 4 # Computes a displayable value for the specified counter.
imp 'PdhGetLogFileSize' PdhGetLogFileSize pdh 0 # Returns the size of the specified log file.
imp 'PdhGetRawCounterArray' PdhGetRawCounterArrayW pdh 0 # Returns an array of raw values from the specified counter. Use this function when you want to retrieve the raw counter values of a counter that contains a wildcard character for the instance name.
imp 'PdhGetRawCounterValue' PdhGetRawCounterValue pdh 0 # Returns the current raw value of the counter.
imp 'PdhIsRealTimeQuery' PdhIsRealTimeQuery pdh 0 # Determines if the specified query is a real-time query.
imp 'PdhLookupPerfIndexByName' PdhLookupPerfIndexByNameW pdh 0 # Returns the counter index corresponding to the specified counter name.
imp 'PdhLookupPerfNameByIndex' PdhLookupPerfNameByIndexW pdh 0 # Returns the performance object name or counter name corresponding to the specified index.
imp 'PdhMakeCounterPath' PdhMakeCounterPathW pdh 0 # Creates a full counter path using the members specified in the PDH_COUNTER_PATH_ELEMENTS structure.
imp 'PdhOpenLog' PdhOpenLogW pdh 0 # Opens the specified log file for reading or writing.
imp 'PdhOpenQuery' PdhOpenQueryW pdh 0 3 # Creates a new query that is used to manage the collection of performance data. To use handles to data sources, use the PdhOpenQueryH function.
imp 'PdhOpenQueryH' PdhOpenQueryH pdh 0 # Creates a new query that is used to manage the collection of performance data. This function is identical to the PdhOpenQuery function, except that it supports the use of handles to data sources.
imp 'PdhParseCounterPath' PdhParseCounterPathW pdh 0 # Parses the elements of the counter path and stores the results in the PDH_COUNTER_PATH_ELEMENTS structure.
imp 'PdhParseInstanceName' PdhParseInstanceNameW pdh 0 # Parses the elements of an instance string.
imp 'PdhReadRawLogRecord' PdhReadRawLogRecord pdh 0 # Reads the information in the specified binary trace log file.
imp 'PdhRemoveCounter' PdhRemoveCounter pdh 0 # Removes a counter from a query.
imp 'PdhSelectDataSource' PdhSelectDataSourceW pdh 0 # Displays a dialog window that prompts the user to specify the source of the performance data.
imp 'PdhSetCounterScaleFactor' PdhSetCounterScaleFactor pdh 0 # Sets the scale factor that is applied to the calculated value of the specified counter when you request the formatted counter value. If the PDH_FMT_NOSCALE flag is set, then this scale factor is ignored.
imp 'PdhSetDefaultRealTimeDataSource' PdhSetDefaultRealTimeDataSource pdh 0 # Specifies the source of the real-time data.
imp 'PdhSetQueryTimeRange' PdhSetQueryTimeRange pdh 0 # Limits the samples that you can read from a log file to those within the specified time range, inclusively.
imp 'PdhUpdateLog' PdhUpdateLogW pdh 0 # Collects counter data for the current query and writes the data to the log file.
imp 'PdhUpdateLogFileCatalog' PdhUpdateLogFileCatalog pdh 0 # Synchronizes the information in the log file catalog with the performance data in the log file.
imp 'PdhValidatePath' PdhValidatePathW pdh 0 # Validates that the counter is present on the computer specified in the counter path.
imp 'PdhValidatePathEx' PdhValidatePathExW pdh 0 # Validates that the specified counter is present on the computer or in the log file.
imp 'PerfAddCounters' PerfAddCounters pdh 0 # Adds performance counter specifications to the specified query.
imp 'PerfCloseQueryHandle' PerfCloseQueryHandle pdh 0 # Closes a query handle that you opened by calling PerfOpenQueryHandle.
imp 'PerfCreateInstance' PerfCreateInstance pdh 0 # Creates an instance of the specified counter set.
imp 'PerfDecrementULongCounterValue' PerfDecrementULongCounterValue pdh 0 # Decrements the value of a counter whose value is a 4-byte unsigned integer. Providers use this function.
imp 'PerfDecrementULongLongCounterValue' PerfDecrementULongLongCounterValue pdh 0 # Decrements the value of a counter whose value is an 8-byte unsigned integer. Providers use this function.
imp 'PerfDeleteCounters' PerfDeleteCounters pdh 0 # Removes the specified performance counter specifications from the specified query.
imp 'PerfDeleteInstance' PerfDeleteInstance pdh 0 # Deletes an instance of the counter set created by the PerfCreateInstance function.
imp 'PerfEnumerateCounterSet' PerfEnumerateCounterSet pdh 0 # Gets the counter set identifiers of the counter sets that are registered on the specified system. Counter set identifiers are globally unique identifiers (GUIDs).
imp 'PerfEnumerateCounterSetInstances' PerfEnumerateCounterSetInstances pdh 0 # Gets the names and identifiers of the active instances of a counter set on the specified system.
imp 'PerfIncrementULongCounterValue' PerfIncrementULongCounterValue pdh 0 # Increments the value of a counter whose value is a 4-byte unsigned integer. Providers use this function.
imp 'PerfIncrementULongLongCounterValue' PerfIncrementULongLongCounterValue pdh 0 # Increments the value of a counter whose value is an 8-byte unsigned integer. Providers use this function.
imp 'PerfOpenQueryHandle' PerfOpenQueryHandle pdh 0 # Creates a handle that references a query on the specified system. A query is a list of counter specifications.
imp 'PerfQueryCounterData' PerfQueryCounterData pdh 0 # Gets the values of the performance counters that match the counter specifications in the specified query.
imp 'PerfQueryCounterInfo' PerfQueryCounterInfo pdh 0 # Gets the counter specifications in the specified query.
imp 'PerfQueryCounterSetRegistrationInfo' PerfQueryCounterSetRegistrationInfo pdh 0 # Gets information about a counter set on the specified system.
imp 'PerfQueryInstance' PerfQueryInstance pdh 0 # Retrieves a pointer to the specified counter set instance. Providers use this function.
imp 'PerfSetCounterRefValue' PerfSetCounterRefValue pdh 0 # Updates the value of a counter whose value is a pointer to the actual data. Providers use this function.
imp 'PerfSetCounterSetInfo' PerfSetCounterSetInfo pdh 0 # Specifies the layout of a particular counter set.
imp 'PerfSetULongCounterValue' PerfSetULongCounterValue pdh 0 # Updates the value of a counter whose value is a 4-byte unsigned integer. Providers use this function.
imp 'PerfSetULongLongCounterValue' PerfSetULongLongCounterValue pdh 0 # Updates the value of a counter whose value is an 8-byte unsigned integer. Providers use this function.
imp 'PerfStartProvider' PerfStartProvider pdh 0 # Registers the provider.
imp 'PerfStartProviderEx' PerfStartProviderEx pdh 0 # Registers the provider.
imp 'PerfStopProvider' PerfStopProvider pdh 0 # Removes the provider's registration from the list of registered providers and frees all resources associated with the provider.
imp 'UnloadPerfCounterTextStrings' UnloadPerfCounterTextStringsW pdh 0 # Unloads performance objects and counters from the computer for the specified application.
imp 'EmptyWorkingSet' EmptyWorkingSet psapi 0
imp 'EnumDeviceDrivers' EnumDeviceDrivers psapi 0
imp 'EnumPageFiles' EnumPageFilesW psapi 0
imp 'EnumProcessModules' EnumProcessModules psapi 0
imp 'EnumProcessModulesEx' EnumProcessModulesEx psapi 0
imp 'EnumProcesses' EnumProcesses psapi 0
imp 'GetDeviceDriverBaseName' GetDeviceDriverBaseNameW psapi 0
imp 'GetDeviceDriverFileName' GetDeviceDriverFileNameW psapi 0
imp 'GetMappedFileName' GetMappedFileNameW psapi 0
imp 'GetModuleBaseName' GetModuleBaseNameW psapi 0
imp 'GetModuleFileNameEx' GetModuleFileNameExW psapi 0
imp 'GetModuleInformation' GetModuleInformation psapi 0
imp 'GetPerformanceInfo' GetPerformanceInfo psapi 0
imp 'GetProcessImageFileName' GetProcessImageFileNameW psapi 0 3
imp 'GetProcessMemoryInfo' GetProcessMemoryInfo psapi 0 3
imp 'GetWsChanges' GetWsChanges psapi 0
imp 'GetWsChangesEx' GetWsChangesEx psapi 0
imp 'InitializeProcessForWsWatch' InitializeProcessForWsWatch psapi 0
imp 'QueryWorkingSet' QueryWorkingSet psapi 0
imp 'QueryWorkingSetEx' QueryWorkingSetEx psapi 0

View file

@ -351,6 +351,44 @@ $(LIBC_NT_POWERPROF_A).pkg: \
#───────────────────────────────────────────────────────────────────────────────
LIBC_NT_ARTIFACTS += LIBC_NT_PDH_A
LIBC_NT_PDH = $(LIBC_NT_PDH_A_DEPS) $(LIBC_NT_PDH_A)
LIBC_NT_PDH_A = o/$(MODE)/libc/nt/pdh.a
LIBC_NT_PDH_A_SRCS := $(wildcard libc/nt/pdh/*.s)
LIBC_NT_PDH_A_OBJS = $(LIBC_NT_PDH_A_SRCS:%.s=o/$(MODE)/%.o)
LIBC_NT_PDH_A_CHECKS = $(LIBC_NT_PDH_A).pkg
LIBC_NT_PDH_A_DIRECTDEPS = LIBC_NT_KERNEL32
LIBC_NT_PDH_A_DEPS := \
$(call uniq,$(foreach x,$(LIBC_NT_PDH_A_DIRECTDEPS),$($(x))))
$(LIBC_NT_PDH_A): \
libc/nt/pdh/ \
$(LIBC_NT_PDH_A).pkg \
$(LIBC_NT_PDH_A_OBJS)
$(LIBC_NT_PDH_A).pkg: \
$(LIBC_NT_PDH_A_OBJS) \
$(foreach x,$(LIBC_NT_PDH_A_DIRECTDEPS),$($(x)_A).pkg)
#───────────────────────────────────────────────────────────────────────────────
LIBC_NT_ARTIFACTS += LIBC_NT_PSAPI_A
LIBC_NT_PSAPI = $(LIBC_NT_PSAPI_A_DEPS) $(LIBC_NT_PSAPI_A)
LIBC_NT_PSAPI_A = o/$(MODE)/libc/nt/psapi.a
LIBC_NT_PSAPI_A_SRCS := $(wildcard libc/nt/psapi/*.s)
LIBC_NT_PSAPI_A_OBJS = $(LIBC_NT_PSAPI_A_SRCS:%.s=o/$(MODE)/%.o)
LIBC_NT_PSAPI_A_CHECKS = $(LIBC_NT_PSAPI_A).pkg
LIBC_NT_PSAPI_A_DIRECTDEPS = LIBC_NT_KERNEL32
LIBC_NT_PSAPI_A_DEPS := \
$(call uniq,$(foreach x,$(LIBC_NT_PSAPI_A_DIRECTDEPS),$($(x))))
$(LIBC_NT_PSAPI_A): \
libc/nt/psapi/ \
$(LIBC_NT_PSAPI_A).pkg \
$(LIBC_NT_PSAPI_A_OBJS)
$(LIBC_NT_PSAPI_A).pkg: \
$(LIBC_NT_PSAPI_A_OBJS) \
$(foreach x,$(LIBC_NT_PSAPI_A_DIRECTDEPS),$($(x)_A).pkg)
#───────────────────────────────────────────────────────────────────────────────
$(LIBC_NT_OBJS): o/libc/nt/codegen.inc
o/libc/nt/codegen.inc: \

48
libc/nt/pdh.h Normal file
View file

@ -0,0 +1,48 @@
#ifndef COSMOPOLITAN_LIBC_NT_PDH_H_
#define COSMOPOLITAN_LIBC_NT_PDH_H_
#include "libc/nt/struct/pdhfmtcountervalue.h"
/* ░░░░
cosmopolitan § new technology » performance counters
*/
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int PdhOpenQuery(const char16_t *opt_szDataSource, uint32_t *dwUserData,
int64_t *out_phQuery);
int PdhAddEnglishCounter(int64_t hQuery, const char16_t *szFullCounterPath,
uint32_t *dwUserData, int64_t *out_phCounter);
int PdhCollectQueryDataEx(int64_t hQuery, uint32_t dwIntervalTime,
int64_t hNewDataEvent);
int PdhGetFormattedCounterValue(int64_t hCounter, uint32_t dwFormat,
uint32_t *out_opt_lpdwType,
struct NtPdhFmtCountervalue *out_pValue);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_PDH_H_ */

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_CounterPathCallBack,CounterPathCallBack,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_LoadPerfCounterTextStringsW,LoadPerfCounterTextStringsW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhAddCounterW,PdhAddCounterW,0

View file

@ -0,0 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhAddEnglishCounterW,PdhAddEnglishCounterW,0
.text.windows
PdhAddEnglishCounter:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_PdhAddEnglishCounterW(%rip),%rax
jmp __sysv2nt
.endfn PdhAddEnglishCounter,globl
.previous

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhBindInputDataSourceW,PdhBindInputDataSourceW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhBrowseCountersHW,PdhBrowseCountersHW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhBrowseCountersW,PdhBrowseCountersW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhCalculateCounterFromRawValue,PdhCalculateCounterFromRawValue,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhCloseLog,PdhCloseLog,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhCloseQuery,PdhCloseQuery,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhCollectQueryData,PdhCollectQueryData,0

View file

@ -0,0 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhCollectQueryDataEx,PdhCollectQueryDataEx,0
.text.windows
PdhCollectQueryDataEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_PdhCollectQueryDataEx(%rip),%rax
jmp __sysv2nt
.endfn PdhCollectQueryDataEx,globl
.previous

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhCollectQueryDataWithTime,PdhCollectQueryDataWithTime,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhComputeCounterStatistics,PdhComputeCounterStatistics,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhConnectMachineW,PdhConnectMachineW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhEnumLogSetNamesW,PdhEnumLogSetNamesW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhEnumMachinesHW,PdhEnumMachinesHW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhEnumMachinesW,PdhEnumMachinesW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhEnumObjectItemsHW,PdhEnumObjectItemsHW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhEnumObjectItemsW,PdhEnumObjectItemsW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhEnumObjectsHW,PdhEnumObjectsHW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhEnumObjectsW,PdhEnumObjectsW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhExpandCounterPathW,PdhExpandCounterPathW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhExpandWildCardPathHW,PdhExpandWildCardPathHW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhExpandWildCardPathW,PdhExpandWildCardPathW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhFormatFromRawValue,PdhFormatFromRawValue,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetCounterInfoW,PdhGetCounterInfoW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetCounterTimeBase,PdhGetCounterTimeBase,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetDataSourceTimeRangeH,PdhGetDataSourceTimeRangeH,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetDataSourceTimeRangeW,PdhGetDataSourceTimeRangeW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetDefaultPerfCounterHW,PdhGetDefaultPerfCounterHW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetDefaultPerfCounterW,PdhGetDefaultPerfCounterW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetDefaultPerfObjectHW,PdhGetDefaultPerfObjectHW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetDefaultPerfObjectW,PdhGetDefaultPerfObjectW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetDllVersion,PdhGetDllVersion,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetFormattedCounterArrayW,PdhGetFormattedCounterArrayW,0

View file

@ -0,0 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetFormattedCounterValue,PdhGetFormattedCounterValue,0
.text.windows
PdhGetFormattedCounterValue:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_PdhGetFormattedCounterValue(%rip),%rax
jmp __sysv2nt
.endfn PdhGetFormattedCounterValue,globl
.previous

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetLogFileSize,PdhGetLogFileSize,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetRawCounterArrayW,PdhGetRawCounterArrayW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhGetRawCounterValue,PdhGetRawCounterValue,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhIsRealTimeQuery,PdhIsRealTimeQuery,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhLookupPerfIndexByNameW,PdhLookupPerfIndexByNameW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhLookupPerfNameByIndexW,PdhLookupPerfNameByIndexW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhMakeCounterPathW,PdhMakeCounterPathW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhOpenLogW,PdhOpenLogW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhOpenQueryH,PdhOpenQueryH,0

View file

@ -0,0 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhOpenQueryW,PdhOpenQueryW,0
.text.windows
PdhOpenQuery:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_PdhOpenQueryW(%rip),%rax
jmp __sysv2nt
.endfn PdhOpenQuery,globl
.previous

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhParseCounterPathW,PdhParseCounterPathW,0

View file

@ -0,0 +1,2 @@
.include "o/libc/nt/codegen.inc"
.imp pdh,__imp_PdhParseInstanceNameW,PdhParseInstanceNameW,0

Some files were not shown because too many files have changed in this diff Show more