VirtualBox

Changeset 95871 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jul 27, 2022 2:38:21 AM (3 years ago)
Author:
vboxsync
Message:

Add/Nt/VBoxHook: Made it build in VBOX_WITH_NOCRT_STATIC mode. bugref:10261

Location:
trunk/src/VBox/Additions/WINNT/VBoxHook
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxHook/VBoxHook.cpp

    r93115 r95871  
    2121*********************************************************************************************************************************/
    2222#include <iprt/win/windows.h>
     23
    2324#include <VBoxHook.h>
    2425#include <VBox/VBoxGuestLib.h>
    2526#ifdef DEBUG
    26 # include <stdio.h>
     27# include <VBox/VBoxGuest.h>
     28# include <VBox/VMMDev.h>
     29# include <iprt/string.h>
    2730#endif
    2831
     
    184187
    185188#ifdef DEBUG
    186 # include <VBox/VBoxGuest.h>
    187 # include <VBox/VMMDev.h>
    188 
    189189/**
    190190 * dprintf worker using VBoxGuest.sys and VMMDevReq_LogString.
     
    225225    va_list va;
    226226    va_start(va, pszFormat);
    227     size_t cch = vsprintf(s_uBuf.Req.szString, pszFormat, va);
     227    size_t cch = RTStrPrintf(s_uBuf.Req.szString, sizeof(s_uBuf.Req.szString), pszFormat, va);
    228228    va_end(va);
    229229
     
    238238                    &cbReturned, NULL);
    239239}
    240 
    241240#endif /* DEBUG */
    242241
  • trunk/src/VBox/Additions/WINNT/VBoxHook/testcase/tstHook.cpp

    r93115 r95871  
    2222#include <iprt/win/windows.h>
    2323#include <VBoxHook.h>
    24 #include <stdio.h>
    2524
    2625
    2726int main()
    2827{
    29     printf("Enabling global hook\n");
     28    DWORD cbIgnores;
     29    WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), RT_STR_TUPLE("Enabling global hook\r\n"), &cbIgnores, NULL);
    3030
    3131    HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, VBOXHOOK_GLOBAL_WT_EVENT_NAME);
    3232
    3333    VBoxHookInstallWindowTracker(GetModuleHandle("VBoxHook.dll"));
    34     getchar();
    3534
    36     printf("Disabling global hook\n");
     35    /* wait for input. */
     36    uint8_t ch;
     37    ReadFile(GetStdHandle(STD_INPUT_HANDLE), &ch, sizeof(ch), &cbIgnores, NULL);
     38
     39    /* disable hook. */
     40    WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), RT_STR_TUPLE("Disabling global hook\r\n"), &cbIgnores, NULL);
    3741    VBoxHookRemoveWindowTracker();
    3842    CloseHandle(hEvent);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette