mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-07-28 03:48:38 +00:00
Merge commit 'dabc40cb19
' as 'ext/detours'
This commit is contained in:
commit
77523940b3
178 changed files with 102613 additions and 0 deletions
94
ext/detours/samples/traceapi/testapi.cpp
Normal file
94
ext/detours/samples/traceapi/testapi.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Detours Test Program (testapi.cpp of testapi.exe)
|
||||
//
|
||||
// Microsoft Research Detours Package
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
#include "trcapi.cpp"
|
||||
|
||||
#if (_MSC_VER < 1299)
|
||||
typedef ULONG * PULONG_PTR;
|
||||
typedef ULONG ULONG_PTR;
|
||||
typedef LONG * PLONG_PTR;
|
||||
typedef LONG LONG_PTR;
|
||||
#endif
|
||||
|
||||
VOID SyelogOpen(PCSTR pszIdentifier, BYTE nFacility)
|
||||
{
|
||||
(void)pszIdentifier;
|
||||
(void)nFacility;
|
||||
}
|
||||
|
||||
VOID SyelogExV(BOOL fTerminate, BYTE nSeverity, PCSTR pszMsgf, va_list args)
|
||||
{
|
||||
(void)fTerminate;
|
||||
|
||||
CHAR szBuffer[1024];
|
||||
PCHAR psz = szBuffer;
|
||||
BOOL fLf = FALSE;
|
||||
|
||||
StringCchPrintfA(psz, szBuffer + sizeof(szBuffer) - psz, "--.%02x: ", nSeverity);
|
||||
while (*psz) {
|
||||
psz++;
|
||||
}
|
||||
|
||||
StringCchVPrintfA(psz, szBuffer + sizeof(szBuffer) - psz, pszMsgf, args);
|
||||
for (psz = szBuffer; *psz; psz++) {
|
||||
if (*psz == '\n') {
|
||||
if (fLf) {
|
||||
*psz = '\0';
|
||||
break;
|
||||
}
|
||||
fLf = TRUE;
|
||||
}
|
||||
}
|
||||
if (!fLf) {
|
||||
*psz++ = '\n';
|
||||
*psz = '\0';
|
||||
}
|
||||
printf("%s", szBuffer);
|
||||
Real_OutputDebugStringA(szBuffer);
|
||||
}
|
||||
|
||||
VOID SyelogV(BYTE nSeverity, PCSTR pszMsgf, va_list args)
|
||||
{
|
||||
SyelogExV(FALSE, nSeverity, pszMsgf, args);
|
||||
}
|
||||
|
||||
VOID Syelog(BYTE nSeverity, PCSTR pszMsgf, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, pszMsgf);
|
||||
SyelogExV(FALSE, nSeverity, pszMsgf, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
VOID SyelogEx(BOOL fTerminate, BYTE nSeverity, PCSTR pszMsgf, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, pszMsgf);
|
||||
SyelogExV(fTerminate, nSeverity, pszMsgf, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
VOID SyelogClose(BOOL fTerminate)
|
||||
{
|
||||
(void)fTerminate;
|
||||
}
|
||||
|
||||
DWORD main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
printf("testapi: Starting\n");
|
||||
ProcessAttach(NULL);
|
||||
Sleep(100);
|
||||
ProcessDetach(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
Loading…
Add table
Add a link
Reference in a new issue