VirtualBox

Ignore:
Timestamp:
Jul 29, 2016 11:04:35 AM (8 years ago)
Author:
vboxsync
Message:

ValidationKit/utils: warnings.

Location:
trunk/src/VBox/ValidationKit/utils/nt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/nt/ntsetfreq.cpp

    r62484 r62673  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
    31 #define _WIN32_WINNT 0x0500
    32 #include <Windows.h>
     31#include <iprt/nt/nt.h>
    3332
    3433#include <iprt/initterm.h>
     
    3938#include <iprt/thread.h>
    4039#include <iprt/err.h>
    41 
    42 RT_C_DECLS_BEGIN
    43 /* from sysinternals. */
    44 NTSYSAPI LONG NTAPI NtSetTimerResolution(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution);
    45 NTSYSAPI LONG NTAPI NtQueryTimerResolution(OUT PULONG MinimumResolution, OUT PULONG MaximumResolution, OUT PULONG CurrentResolution);
    46 RT_C_DECLS_END
    47 
    4840
    4941
     
    109101     * Query the current resolution.
    110102     */
    111     ULONG   Cur = ~0;
    112     ULONG   Min = ~0;
    113     ULONG   Max = ~0;
    114     LONG    Status;
     103    ULONG    Cur = UINT32_MAX;
     104    ULONG    Min = UINT32_MAX;
     105    ULONG    Max = UINT32_MAX;
     106    NTSTATUS rcNt = STATUS_SUCCESS;
    115107    if (fVerbose || !u32NewRes)
    116108    {
    117         Status = NtQueryTimerResolution(&Min, &Max, &Cur);
    118         if (Status >= 0)
     109        rcNt = NtQueryTimerResolution(&Min, &Max, &Cur);
     110        if (NT_SUCCESS(rcNt))
    119111            RTMsgInfo("cur: %u (%u.%02u Hz)  min: %u (%u.%02u Hz)  max: %u (%u.%02u Hz)\n",
    120112                      Cur, 10000000 / Cur, (10000000 / (Cur * 100)) % 100,
     
    122114                      Max, 10000000 / Max, (10000000 / (Max * 100)) % 100);
    123115        else
    124             RTMsgError("NTQueryTimerResolution failed with status %#x\n", Status);
     116            RTMsgError("NTQueryTimerResolution failed with status %#x\n", rcNt);
    125117    }
    126118
    127119    if (u32NewRes)
    128120    {
    129         Status = NtSetTimerResolution(u32NewRes, TRUE, &Cur);
    130         if (Status < 0)
    131             RTMsgError("NTSetTimerResolution(%RU32,,) failed with status %#x\n", u32NewRes, Status);
     121        rcNt = NtSetTimerResolution(u32NewRes, TRUE, &Cur);
     122        if (!NT_SUCCESS(rcNt))
     123            RTMsgError("NTSetTimerResolution(%RU32,,) failed with status %#x\n", u32NewRes, rcNt);
    132124        else if (fVerbose)
    133125        {
    134             Cur = Min = Max = ~0;
    135             Status = NtQueryTimerResolution(&Min, &Max, &Cur);
    136             if (Status >= 0)
     126            Cur = Min = Max = UINT32_MAX;
     127            rcNt = NtQueryTimerResolution(&Min, &Max, &Cur);
     128            if (NT_SUCCESS(rcNt))
    137129                RTMsgInfo("new: %u (%u.%02u Hz) requested %RU32 (%u.%02u Hz)\n",
    138130                          Cur, 10000000 / Cur, (10000000 / (Cur * 100)) % 100,
    139131                          u32NewRes, 10000000 / u32NewRes, (10000000 / (u32NewRes * 100)) % 100);
    140132            else
    141                 RTMsgError("NTSetTimerResolution succeeded but the NTQueryTimerResolution call failed with status %#x (ignored)\n", Status);
    142             Status = 0;
     133                RTMsgError("NTSetTimerResolution succeeded but the NTQueryTimerResolution call failed with status %#x (ignored)\n",
     134                           rcNt);
     135            rcNt = STATUS_SUCCESS;
    143136        }
    144137    }
    145138
    146     if (u32NewRes && Status >= 0)
     139    if (u32NewRes && NT_SUCCESS(rcNt))
    147140    {
    148141        if (cSecsSleep == UINT32_MAX)
     
    154147    }
    155148
    156     return Status >= 0 ? 0 : 1;
     149    return NT_SUCCESS(rcNt) ? 0 : 1;
    157150}
    158151
  • trunk/src/VBox/ValidationKit/utils/nt/nttimesources.cpp

    r62484 r62673  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
    31 #include <Windows.h>
     31#include <iprt/win/windows.h>
    3232
    3333#include <iprt/asm.h>
     
    8484int main(int argc, char **argv)
    8585{
     86    RT_NOREF1(argv);
     87
    8688    /*
    8789     * Init, create a test instance and "parse" arguments.
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