您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BaseSetLastNTError函数代码示例

51自学网 2021-06-01 19:54:41
  C++
这篇教程C++ BaseSetLastNTError函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BaseSetLastNTError函数的典型用法代码示例。如果您正苦于以下问题:C++ BaseSetLastNTError函数的具体用法?C++ BaseSetLastNTError怎么用?C++ BaseSetLastNTError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BaseSetLastNTError函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetTimeZoneInformation

/* * @implemented */BOOLWINAPISetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation){    NTSTATUS Status;    DPRINT("SetTimeZoneInformation()/n");    Status = RtlSetTimeZoneInformation((LPTIME_ZONE_INFORMATION)lpTimeZoneInformation);    if (!NT_SUCCESS(Status))    {        DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)/n", Status);        BaseSetLastNTError(Status);        return FALSE;    }    Status = NtSetSystemInformation(SystemCurrentTimeZoneInformation,                                    (PVOID)lpTimeZoneInformation,                                    sizeof(TIME_ZONE_INFORMATION));    if (!NT_SUCCESS(Status))    {        DPRINT1("NtSetSystemInformation() failed (Status %lx)/n", Status);        BaseSetLastNTError(Status);        return FALSE;    }    return TRUE;}
开发者ID:GYGit,项目名称:reactos,代码行数:31,


示例2: GetCurrentActCtx

/* * @implemented */BOOLWINAPIGetCurrentActCtx(OUT PHANDLE phActCtx){    NTSTATUS Status;    /* Check if the output handle pointer was invalid */    if (phActCtx == NULL)    {        /* Set error and bail out */        BaseSetLastNTError(STATUS_INVALID_PARAMETER);        return FALSE;    }    /* Call the native API */    Status = RtlGetActiveActivationContext(phActCtx);    if (!NT_SUCCESS(Status))    {        /* Set error and bail out */        BaseSetLastNTError(STATUS_INVALID_PARAMETER);        return FALSE;    }    /* It worked */    return TRUE;}
开发者ID:Strongc,项目名称:reactos,代码行数:29,


示例3: DebugSetProcessKillOnExit

/* * @implemented */BOOLWINAPIDebugSetProcessKillOnExit(IN BOOL KillOnExit){    HANDLE Handle;    NTSTATUS Status;    ULONG State;    /* Get the debug object */    Handle = DbgUiGetThreadDebugObject();    if (!Handle)    {        /* Fail */        BaseSetLastNTError(STATUS_INVALID_HANDLE);        return FALSE;    }    /* Now set the kill-on-exit state */    State = KillOnExit != 0;    Status = NtSetInformationDebugObject(Handle,                                         DebugObjectKillProcessOnExitInformation,                                         &State,                                         sizeof(State),                                         NULL);    if (!NT_SUCCESS(Status))    {        /* Fail */        BaseSetLastNTError(Status);        return FALSE;    }    /* Success */    return TRUE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:37,


示例4: ActivateActCtx

/* * @implemented */BOOLWINAPIActivateActCtx(IN HANDLE hActCtx,               OUT PULONG_PTR ulCookie){    NTSTATUS Status;    /* Check if the handle was invalid */    if (hActCtx == INVALID_HANDLE_VALUE)    {        /* Set error and bail out */        BaseSetLastNTError(STATUS_INVALID_PARAMETER);        return FALSE;    }    /* Call the native API */    Status = RtlActivateActivationContext(0, hActCtx, ulCookie);    if (!NT_SUCCESS(Status))    {        /* Set error and bail out */        BaseSetLastNTError(STATUS_INVALID_PARAMETER);        return FALSE;    }    /* It worked */    return TRUE;}
开发者ID:Strongc,项目名称:reactos,代码行数:30,


示例5: QueryFullProcessImageNameW

/* * @implemented */BOOLWINAPIQueryFullProcessImageNameW(HANDLE hProcess,                           DWORD dwFlags,                           LPWSTR lpExeName,                           PDWORD pdwSize){    BYTE Buffer[sizeof(UNICODE_STRING) + MAX_PATH * sizeof(WCHAR)];    UNICODE_STRING *DynamicBuffer = NULL;    UNICODE_STRING *Result = NULL;    NTSTATUS Status;    DWORD Needed;    Status = NtQueryInformationProcess(hProcess,                                       ProcessImageFileName,                                       Buffer,                                       sizeof(Buffer) - sizeof(WCHAR),                                       &Needed);    if (Status == STATUS_INFO_LENGTH_MISMATCH)    {        DynamicBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Needed + sizeof(WCHAR));        if (!DynamicBuffer)        {            BaseSetLastNTError(STATUS_NO_MEMORY);            return FALSE;        }        Status = NtQueryInformationProcess(hProcess,                                           ProcessImageFileName,                                           (LPBYTE)DynamicBuffer,                                           Needed,                                           &Needed);        Result = DynamicBuffer;    }    else Result = (PUNICODE_STRING)Buffer;    if (!NT_SUCCESS(Status)) goto Cleanup;    if (Result->Length / sizeof(WCHAR) + 1 > *pdwSize)    {        Status = STATUS_BUFFER_TOO_SMALL;        goto Cleanup;    }    *pdwSize = Result->Length / sizeof(WCHAR);    memcpy(lpExeName, Result->Buffer, Result->Length);    lpExeName[*pdwSize] = 0;Cleanup:    RtlFreeHeap(RtlGetProcessHeap(), 0, DynamicBuffer);    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);    }    return !Status;}
开发者ID:hoangduit,项目名称:reactos,代码行数:61,


示例6: MoveFileExA

BOOLAPIENTRYMoveFileExA(    LPCSTR lpExistingFileName,    LPCSTR lpNewFileName,    DWORD dwFlags    )/*++Routine Description:    ANSI thunk to MoveFileW--*/{    PUNICODE_STRING Unicode;    UNICODE_STRING UnicodeNewFileName;    ANSI_STRING AnsiString;    NTSTATUS Status;    BOOL ReturnValue;    Unicode = &NtCurrentTeb()->StaticUnicodeString;    RtlInitAnsiString(&AnsiString,lpExistingFileName);    Status = Basep8BitStringToUnicodeString(Unicode,&AnsiString,FALSE);    if ( !NT_SUCCESS(Status) ) {        if ( Status == STATUS_BUFFER_OVERFLOW ) {            SetLastError(ERROR_FILENAME_EXCED_RANGE);            }        else {            BaseSetLastNTError(Status);            }        return FALSE;        }    if (ARGUMENT_PRESENT( lpNewFileName )) {        RtlInitAnsiString(&AnsiString,lpNewFileName);        Status = Basep8BitStringToUnicodeString(&UnicodeNewFileName,&AnsiString,TRUE);        if ( !NT_SUCCESS(Status) ) {            BaseSetLastNTError(Status);            return FALSE;            }        }    else {        UnicodeNewFileName.Buffer = NULL;        }    ReturnValue = MoveFileExW((LPCWSTR)Unicode->Buffer,(LPCWSTR)UnicodeNewFileName.Buffer,dwFlags);    if (UnicodeNewFileName.Buffer != NULL) {        RtlFreeUnicodeString(&UnicodeNewFileName);        }    return ReturnValue;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:57,


示例7: SetTimeZoneInformation

/* * @implemented */BOOLWINAPISetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation){    RTL_TIME_ZONE_INFORMATION TimeZoneInformation;    NTSTATUS Status;    DPRINT("SetTimeZoneInformation()/n");    TimeZoneInformation.Bias = lpTimeZoneInformation->Bias;    wcsncpy(TimeZoneInformation.StandardName,            lpTimeZoneInformation->StandardName,            ARRAYSIZE(TimeZoneInformation.StandardName));    TimeZoneInformation.StandardDate.Year = lpTimeZoneInformation->StandardDate.wYear;    TimeZoneInformation.StandardDate.Month = lpTimeZoneInformation->StandardDate.wMonth;    TimeZoneInformation.StandardDate.Day = lpTimeZoneInformation->StandardDate.wDay;    TimeZoneInformation.StandardDate.Hour = lpTimeZoneInformation->StandardDate.wHour;    TimeZoneInformation.StandardDate.Minute = lpTimeZoneInformation->StandardDate.wMinute;    TimeZoneInformation.StandardDate.Second = lpTimeZoneInformation->StandardDate.wSecond;    TimeZoneInformation.StandardDate.Milliseconds = lpTimeZoneInformation->StandardDate.wMilliseconds;    TimeZoneInformation.StandardDate.Weekday = lpTimeZoneInformation->StandardDate.wDayOfWeek;    TimeZoneInformation.StandardBias = lpTimeZoneInformation->StandardBias;    wcsncpy(TimeZoneInformation.DaylightName,            lpTimeZoneInformation->DaylightName,            ARRAYSIZE(TimeZoneInformation.DaylightName));    TimeZoneInformation.DaylightDate.Year = lpTimeZoneInformation->DaylightDate.wYear;    TimeZoneInformation.DaylightDate.Month = lpTimeZoneInformation->DaylightDate.wMonth;    TimeZoneInformation.DaylightDate.Day = lpTimeZoneInformation->DaylightDate.wDay;    TimeZoneInformation.DaylightDate.Hour = lpTimeZoneInformation->DaylightDate.wHour;    TimeZoneInformation.DaylightDate.Minute = lpTimeZoneInformation->DaylightDate.wMinute;    TimeZoneInformation.DaylightDate.Second = lpTimeZoneInformation->DaylightDate.wSecond;    TimeZoneInformation.DaylightDate.Milliseconds = lpTimeZoneInformation->DaylightDate.wMilliseconds;    TimeZoneInformation.DaylightDate.Weekday = lpTimeZoneInformation->DaylightDate.wDayOfWeek;    TimeZoneInformation.DaylightBias = lpTimeZoneInformation->DaylightBias;    Status = RtlSetTimeZoneInformation(&TimeZoneInformation);    if (!NT_SUCCESS(Status))    {        DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)/n", Status);        BaseSetLastNTError(Status);        return FALSE;    }    Status = NtSetSystemInformation(SystemCurrentTimeZoneInformation,                                    (PVOID)&TimeZoneInformation,                                    sizeof(RTL_TIME_ZONE_INFORMATION));    if (!NT_SUCCESS(Status))    {        DPRINT1("NtSetSystemInformation() failed (Status %lx)/n", Status);        BaseSetLastNTError(Status);        return FALSE;    }    return TRUE;}
开发者ID:Moteesh,项目名称:reactos,代码行数:60,


示例8: GetQueuedCompletionStatus

/* * @implemented */BOOLWINAPIGetQueuedCompletionStatus(IN HANDLE CompletionHandle,                          IN LPDWORD lpNumberOfBytesTransferred,                          OUT PULONG_PTR lpCompletionKey,                          OUT LPOVERLAPPED *lpOverlapped,                          IN DWORD dwMilliseconds){    NTSTATUS Status;    IO_STATUS_BLOCK IoStatus;    ULONG_PTR CompletionKey;    LARGE_INTEGER Time;    PLARGE_INTEGER TimePtr;    /* Convert the timeout and then call the native API */    TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds);    Status = NtRemoveIoCompletion(CompletionHandle,                                  (PVOID*)&CompletionKey,                                  (PVOID*)lpOverlapped,                                  &IoStatus,                                  TimePtr);    if (!(NT_SUCCESS(Status)) || (Status == STATUS_TIMEOUT))    {        /* Clear out the overlapped output */        *lpOverlapped = NULL;        /* Check what kind of error we got */        if (Status == STATUS_TIMEOUT)        {            /* Timeout error is set directly since there's no conversion */            SetLastError(WAIT_TIMEOUT);        }        else        {            /* Any other error gets converted */            BaseSetLastNTError(Status);        }        /* This is a failure case */        return FALSE;    }    /* Write back the output parameters */    *lpCompletionKey = CompletionKey;    *lpNumberOfBytesTransferred = IoStatus.Information;    /* Check for error */    if (!NT_SUCCESS(IoStatus.Status))    {        /* Convert and fail */        BaseSetLastNTError(IoStatus.Status);        return FALSE;    }    /* Return success */    return TRUE;}
开发者ID:RPG-7,项目名称:reactos,代码行数:60,


示例9: LockFileEx

/* * @implemented */BOOLWINAPILockFileEx(IN HANDLE hFile,           IN DWORD dwFlags,           IN DWORD dwReserved,           IN DWORD nNumberOfBytesToLockLow,           IN DWORD nNumberOfBytesToLockHigh,           IN LPOVERLAPPED lpOverlapped){    LARGE_INTEGER BytesToLock, Offset;    NTSTATUS Status;    /* Is this a console handle? */    if (IsConsoleHandle(hFile))    {        /* Can't "lock" a console! */        BaseSetLastNTError(STATUS_INVALID_HANDLE);        return FALSE;    }    /* This parameter should be zero */    if (dwReserved)    {        /* Fail since it isn't */        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    }    /* Set the initial status in the IO_STATUS_BLOCK to pending... */    lpOverlapped->Internal = STATUS_PENDING;    /* Convert the parameters to NT format and call the native API */    Offset.u.LowPart = lpOverlapped->Offset;    Offset.u.HighPart = lpOverlapped->OffsetHigh;    BytesToLock.u.LowPart = nNumberOfBytesToLockLow;    BytesToLock.u.HighPart = nNumberOfBytesToLockHigh;    Status = NtLockFile(hFile,                        lpOverlapped->hEvent,                        NULL,                        NULL,                        (PIO_STATUS_BLOCK)lpOverlapped,                        &Offset,                        &BytesToLock,                        0,                        dwFlags & LOCKFILE_FAIL_IMMEDIATELY ? TRUE : FALSE,                        dwFlags & LOCKFILE_EXCLUSIVE_LOCK ? TRUE: FALSE);    if ((NT_SUCCESS(Status)) && (Status != STATUS_PENDING))    {        /* Pending status is *not* allowed in the Ex API */        return TRUE;    }    /* Convert the error code and fail */    BaseSetLastNTError(Status);    return FALSE;}
开发者ID:GYGit,项目名称:reactos,代码行数:59,


示例10: CreateToolhelp32Snapshot

/* * @implemented */HANDLEWINAPICreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID){  PRTL_DEBUG_INFORMATION HeapDebug, ModuleDebug;  PVOID ProcThrdInfo;  SIZE_T ProcThrdInfoSize;  NTSTATUS Status;  HANDLE hSnapShotSection = NULL;  if(th32ProcessID == 0)  {    th32ProcessID = GetCurrentProcessId();  }  /*   * Get all information required for the snapshot   */  Status = TH32CreateSnapshot(dwFlags,                              th32ProcessID,                              &HeapDebug,                              &ModuleDebug,                              &ProcThrdInfo,                              &ProcThrdInfoSize);  if(!NT_SUCCESS(Status))  {    BaseSetLastNTError(Status);    return NULL;  }  /*   * Create a section handle and initialize the collected information   */  Status = TH32CreateSnapshotSectionInitialize(dwFlags,                                               th32ProcessID,                                               HeapDebug,                                               ModuleDebug,                                               ProcThrdInfo,                                               &hSnapShotSection);  /*   * Free the temporarily allocated memory which is no longer needed   */  TH32FreeAllocatedResources(HeapDebug,                             ModuleDebug,                             ProcThrdInfo,                             ProcThrdInfoSize);  if(!NT_SUCCESS(Status))  {    BaseSetLastNTError(Status);    return NULL;  }  return hSnapShotSection;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:59,


示例11: LockFile

/* * @implemented */BOOLWINAPILockFile(IN HANDLE hFile,         IN DWORD dwFileOffsetLow,         IN DWORD dwFileOffsetHigh,         IN DWORD nNumberOfBytesToLockLow,         IN DWORD nNumberOfBytesToLockHigh){    IO_STATUS_BLOCK IoStatusBlock;    NTSTATUS Status;    LARGE_INTEGER BytesToLock, Offset;    /* Is this a console handle? */    if (IsConsoleHandle(hFile))    {        /* Can't "lock" a console! */        BaseSetLastNTError(STATUS_INVALID_HANDLE);        return FALSE;    }    /* Setup the parameters in NT style and call the native API */    BytesToLock.u.LowPart = nNumberOfBytesToLockLow;    BytesToLock.u.HighPart = nNumberOfBytesToLockHigh;    Offset.u.LowPart = dwFileOffsetLow;    Offset.u.HighPart = dwFileOffsetHigh;    Status = NtLockFile(hFile,                        NULL,                        NULL,                        NULL,                        &IoStatusBlock,                        &Offset,                        &BytesToLock,                        0,                        TRUE,                        TRUE);    if (Status == STATUS_PENDING)    {        /* Wait for completion if needed */        Status = NtWaitForSingleObject(hFile, FALSE, NULL);        if (NT_SUCCESS(Status)) Status = IoStatusBlock.Status;    }    /* Check if we failed */    if (!NT_SUCCESS(Status))    {        /* Convert the error code and fail */        BaseSetLastNTError(Status);        return FALSE;    }    /* Success! */    return TRUE;}
开发者ID:GYGit,项目名称:reactos,代码行数:56,


示例12: GetProcAddress

/* * @implemented */FARPROCWINAPIGetProcAddress(HMODULE hModule, LPCSTR lpProcName){    ANSI_STRING ProcedureName, *ProcNamePtr = NULL;    FARPROC fnExp = NULL;    NTSTATUS Status;    PVOID hMapped;    ULONG Ordinal = 0;    if (HIWORD(lpProcName) != 0)    {        /* Look up by name */        RtlInitAnsiString(&ProcedureName, (LPSTR)lpProcName);        ProcNamePtr = &ProcedureName;    }    else    {        /* Look up by ordinal */        Ordinal = (ULONG)lpProcName;    }    /* Map provided handle */    hMapped = BasepMapModuleHandle(hModule, FALSE);    /* Get the proc address */    Status = LdrGetProcedureAddress(hMapped,                                    ProcNamePtr,                                    Ordinal,                                    (PVOID*)&fnExp);    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);        return NULL;    }    /* Check for a special case when returned pointer is       the same as iamge's base address */    if (fnExp == hMapped)    {        /* Set correct error code */        if (HIWORD(lpProcName) != 0)            BaseSetLastNTError(STATUS_ENTRYPOINT_NOT_FOUND);        else            BaseSetLastNTError(STATUS_ORDINAL_NOT_FOUND);        return NULL;    }    /* All good, return procedure pointer */    return fnExp;}
开发者ID:RareHare,项目名称:reactos,代码行数:56,


示例13: DuplicateHandle

/* * @implemented */BOOLWINAPIDuplicateHandle(IN HANDLE hSourceProcessHandle,                IN HANDLE hSourceHandle,                IN HANDLE hTargetProcessHandle,                OUT LPHANDLE lpTargetHandle,                IN DWORD dwDesiredAccess,                IN BOOL bInheritHandle,                IN DWORD dwOptions){    NTSTATUS Status;    HANDLE hTargetHandle;    hSourceHandle = TranslateStdHandle(hSourceHandle);    if ((IsConsoleHandle(hSourceHandle)) &&        ((hSourceHandle != NtCurrentProcess()) &&         (hSourceHandle != NtCurrentThread())))    {        if ((hSourceProcessHandle != NtCurrentProcess()) &&            (hTargetProcessHandle != NtCurrentProcess()))        {            BaseSetLastNTError(STATUS_INVALID_PARAMETER);            return FALSE;        }        hTargetHandle = DuplicateConsoleHandle(hSourceHandle,                                               dwDesiredAccess,                                               bInheritHandle,                                               dwOptions);        if (hTargetHandle != INVALID_HANDLE_VALUE)        {            if (lpTargetHandle) *lpTargetHandle = hTargetHandle;            return TRUE;        }        return FALSE;    }    Status = NtDuplicateObject(hSourceProcessHandle,                               hSourceHandle,                               hTargetProcessHandle,                               lpTargetHandle,                               dwDesiredAccess,                               bInheritHandle ? OBJ_INHERIT : 0,                               dwOptions);    if (NT_SUCCESS(Status)) return TRUE;    BaseSetLastNTError(Status);    return FALSE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:54,


示例14: SetHandleInformation

/* * @implemented */BOOLWINAPISetHandleInformation(IN HANDLE hObject,                     IN DWORD dwMask,                     IN DWORD dwFlags){    OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;    ULONG BytesWritten;    NTSTATUS Status;    hObject = TranslateStdHandle(hObject);    if (IsConsoleHandle(hObject))    {        /* FIXME: SetConsoleHandleInformation required */        UNIMPLEMENTED;        BaseSetLastNTError(STATUS_NOT_IMPLEMENTED);        return FALSE;    }    Status = NtQueryObject(hObject,                           ObjectHandleFlagInformation,                           &HandleInfo,                           sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),                           &BytesWritten);    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);        return FALSE;    }    if (dwMask & HANDLE_FLAG_INHERIT)    {        HandleInfo.Inherit = (dwFlags & HANDLE_FLAG_INHERIT) != 0;    }    if (dwMask & HANDLE_FLAG_PROTECT_FROM_CLOSE)    {        HandleInfo.ProtectFromClose = (dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;    }    Status = NtSetInformationObject(hObject,                                    ObjectHandleFlagInformation,                                    &HandleInfo,                                    sizeof(HandleInfo));    if (NT_SUCCESS(Status)) return TRUE;    BaseSetLastNTError(Status);    return FALSE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:53,


示例15: GetCompressedFileSizeA

DWORDWINAPIGetCompressedFileSizeA(    LPCSTR lpFileName,    LPDWORD lpFileSizeHigh    ){    PUNICODE_STRING Unicode;    ANSI_STRING AnsiString;    NTSTATUS Status;    Unicode = &NtCurrentTeb()->StaticUnicodeString;    RtlInitAnsiString(&AnsiString,lpFileName);    Status = Basep8BitStringToUnicodeString(Unicode,&AnsiString,FALSE);    if ( !NT_SUCCESS(Status) ) {        if ( Status == STATUS_BUFFER_OVERFLOW ) {            SetLastError(ERROR_FILENAME_EXCED_RANGE);            }        else {            BaseSetLastNTError(Status);            }        return (DWORD)-1;        }    return ( GetCompressedFileSizeW((LPCWSTR)Unicode->Buffer,lpFileSizeHigh) );    return INVALID_FILE_SIZE;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:27,


示例16: SleepConditionVariableSRW

/* * @implemented */BOOLWINAPISleepConditionVariableSRW(IN OUT PCONDITION_VARIABLE ConditionVariable,                          IN OUT PSRWLOCK SRWLock,                          IN DWORD dwMilliseconds,                          IN ULONG Flags){    NTSTATUS Status = 0;    LARGE_INTEGER TimeOut;    PLARGE_INTEGER TimeOutPtr = NULL;    if (dwMilliseconds != INFINITE)    {        TimeOut.QuadPart = dwMilliseconds * -10000LL;        TimeOutPtr = &TimeOut;    }#if 0    Status = RtlSleepConditionVariableSRW((PRTL_CONDITION_VARIABLE)ConditionVariable,                                          (PRTL_SRWLOCK)SRWLock,                                          TimeOutPtr,                                          Flags);#endif    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);        return FALSE;    }    return TRUE;}
开发者ID:hoangduit,项目名称:reactos,代码行数:34,


示例17: SleepConditionVariableCS

/* * @implemented */BOOLWINAPISleepConditionVariableCS(IN OUT PCONDITION_VARIABLE ConditionVariable,                         IN OUT PCRITICAL_SECTION CriticalSection,                         IN DWORD dwMilliseconds){    NTSTATUS Status = 0;    LARGE_INTEGER TimeOut;    PLARGE_INTEGER TimeOutPtr = NULL;    if (dwMilliseconds != INFINITE)    {        TimeOut.QuadPart = dwMilliseconds * -10000LL;        TimeOutPtr = &TimeOut;    }#if 0    Status = RtlSleepConditionVariableCS((PRTL_CONDITION_VARIABLE)ConditionVariable,                                         (PRTL_CRITICAL_SECTION)CriticalSection,                                         TimeOutPtr);#endif    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);        return FALSE;    }    return TRUE;}
开发者ID:hoangduit,项目名称:reactos,代码行数:32,


示例18: GetConsoleAliasExesLengthW

/* * @implemented */DWORDWINAPIGetConsoleAliasExesLengthW(VOID){    NTSTATUS Status;    CONSOLE_API_MESSAGE ApiMessage;    PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &ApiMessage.Data.GetAliasesExesLengthRequest;    DPRINT("GetConsoleAliasExesLengthW entered/n");    GetAliasesExesLengthRequest->Length = 0;    Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,                                 NULL,                                 CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetAliasExesLength),                                 sizeof(CONSOLE_GETALIASESEXESLENGTH));    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);        return 0;    }    return GetAliasesExesLengthRequest->Length;}
开发者ID:RareHare,项目名称:reactos,代码行数:28,


示例19: ReadFileEx

/* * @implemented */BOOL WINAPIReadFileEx(IN HANDLE hFile,           IN LPVOID lpBuffer,           IN DWORD nNumberOfBytesToRead OPTIONAL,           IN LPOVERLAPPED lpOverlapped,           IN LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine){    LARGE_INTEGER Offset;    NTSTATUS Status;    Offset.u.LowPart = lpOverlapped->Offset;    Offset.u.HighPart = lpOverlapped->OffsetHigh;    lpOverlapped->Internal = STATUS_PENDING;    Status = NtReadFile(hFile,                        NULL,                        ApcRoutine,                        lpCompletionRoutine,                        (PIO_STATUS_BLOCK)lpOverlapped,                        lpBuffer,                        nNumberOfBytesToRead,                        &Offset,                        NULL);    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);        return FALSE;    }    return TRUE;}
开发者ID:hoangduit,项目名称:reactos,代码行数:35,


示例20: GetLogicalProcessorInformation

/* * @implemented */BOOLWINAPIGetLogicalProcessorInformation(OUT PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer,                               IN OUT PDWORD ReturnLength){    NTSTATUS Status;    if (!ReturnLength)    {        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    }    Status = NtQuerySystemInformation(SystemLogicalProcessorInformation,                                      Buffer,                                      *ReturnLength,                                      ReturnLength);    /* Normalize the error to what Win32 expects */    if (Status == STATUS_INFO_LENGTH_MISMATCH) Status = STATUS_BUFFER_TOO_SMALL;    if (!NT_SUCCESS(Status))    {        BaseSetLastNTError(Status);        return FALSE;    }    return TRUE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:31,


示例21: SetWaitableTimer

/* * @implemented */BOOLWINAPISetWaitableTimer(IN HANDLE hTimer,                 IN const LARGE_INTEGER *pDueTime,                 IN LONG lPeriod,                 IN PTIMERAPCROUTINE pfnCompletionRoutine OPTIONAL,                 IN OPTIONAL LPVOID lpArgToCompletionRoutine,                 IN BOOL fResume){    NTSTATUS Status;    /* Set the timer */    Status = NtSetTimer(hTimer,                        (PLARGE_INTEGER)pDueTime,                        (PTIMER_APC_ROUTINE)pfnCompletionRoutine,                        lpArgToCompletionRoutine,                        (BOOLEAN)fResume,                        lPeriod,                        NULL);    if (NT_SUCCESS(Status)) return TRUE;    /* If we got here, then we failed */    BaseSetLastNTError(Status);    return FALSE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:28,


示例22: FlushViewOfFile

/* * @implemented */BOOLNTAPIFlushViewOfFile(LPCVOID lpBaseAddress,                SIZE_T dwNumberOfBytesToFlush){    SIZE_T NumberOfBytesToFlush;    NTSTATUS Status;    IO_STATUS_BLOCK IoStatusBlock;    /* Save amount of bytes to flush to a local var */    NumberOfBytesToFlush = dwNumberOfBytesToFlush;    /* Flush the view */    Status = NtFlushVirtualMemory(NtCurrentProcess(),                                  (LPVOID)lpBaseAddress,                                  &NumberOfBytesToFlush,                                  &IoStatusBlock);    if (!NT_SUCCESS(Status))    {        /* We failed */        BaseSetLastNTError(Status);        return FALSE;    }    /* Return success */    return TRUE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:30,


示例23: ProcessIdToHandle

HANDLEWINAPIProcessIdToHandle(IN DWORD dwProcessId){    NTSTATUS Status;    OBJECT_ATTRIBUTES ObjectAttributes;    HANDLE Handle;    CLIENT_ID ClientId;    /* If we don't have a PID, look it up */    if (dwProcessId == MAXDWORD) dwProcessId = (DWORD_PTR)CsrGetProcessId();    /* Open a handle to the process */    ClientId.UniqueThread = NULL;    ClientId.UniqueProcess = UlongToHandle(dwProcessId);    InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL);    Status = NtOpenProcess(&Handle,                           PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION |                           PROCESS_VM_WRITE | PROCESS_VM_READ |                           PROCESS_SUSPEND_RESUME | PROCESS_QUERY_INFORMATION,                           &ObjectAttributes,                           &ClientId);    if (!NT_SUCCESS(Status))    {        /* Fail */        BaseSetLastNTError(Status);        return 0;    }    /* Return the handle */    return Handle;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:32,


示例24: CheckRemoteDebuggerPresent

/* * @implemented */BOOLWINAPICheckRemoteDebuggerPresent(IN HANDLE hProcess,                           OUT PBOOL pbDebuggerPresent){    HANDLE DebugPort;    NTSTATUS Status;    /* Make sure we have an output and process*/    if (!(pbDebuggerPresent) || !(hProcess))    {        /* Fail */        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    }    /* Check if the process has a debug object/port */    Status = NtQueryInformationProcess(hProcess,                                       ProcessDebugPort,                                       (PVOID)&DebugPort,                                       sizeof(HANDLE),                                       NULL);    if (NT_SUCCESS(Status))    {        /* Return the current state */        *pbDebuggerPresent = DebugPort != NULL;        return TRUE;    }    /* Otherwise, fail */    BaseSetLastNTError(Status);    return FALSE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:36,


示例25: DeleteFileA

BOOLAPIENTRYDeleteFileA(    LPCSTR lpFileName    )/*++Routine Description:    ANSI thunk to DeleteFileW--*/{    PUNICODE_STRING Unicode;    ANSI_STRING AnsiString;    NTSTATUS Status;    Unicode = &NtCurrentTeb()->StaticUnicodeString;    RtlInitAnsiString(&AnsiString,lpFileName);    Status = Basep8BitStringToUnicodeString(Unicode,&AnsiString,FALSE);    if ( !NT_SUCCESS(Status) ) {        if ( Status == STATUS_BUFFER_OVERFLOW ) {            SetLastError(ERROR_FILENAME_EXCED_RANGE);            }        else {            BaseSetLastNTError(Status);            }        return FALSE;        }    return ( DeleteFileW((LPCWSTR)Unicode->Buffer) );}
开发者ID:mingpen,项目名称:OpenNT,代码行数:33,


示例26: UnregisterWaitEx

/* * @implemented */BOOLWINAPIUnregisterWaitEx(IN HANDLE WaitHandle,                 IN HANDLE CompletionEvent){    NTSTATUS Status;    /* Check for invalid handle */    if (!WaitHandle)    {        /* Fail */        SetLastError(ERROR_INVALID_HANDLE);        return FALSE;    }    /* Deregister the wait and check status */    Status = RtlDeregisterWaitEx(WaitHandle, CompletionEvent);    if (!(NT_SUCCESS(Status)) ||        ((CompletionEvent != INVALID_HANDLE_VALUE) && (Status == STATUS_PENDING)))    {        /* Failure or non-blocking call */        BaseSetLastNTError(Status);        return FALSE;    }    /* All good */    return TRUE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:31,


示例27: PostQueuedCompletionStatus

/* * @implemented */BOOLWINAPIPostQueuedCompletionStatus(IN HANDLE CompletionHandle,                           IN DWORD dwNumberOfBytesTransferred,                           IN ULONG_PTR dwCompletionKey,                           IN LPOVERLAPPED lpOverlapped){    NTSTATUS Status;    /* Call the native API */    Status = NtSetIoCompletion(CompletionHandle,                               (PVOID)dwCompletionKey,                               (PVOID)lpOverlapped,                               STATUS_SUCCESS,                               dwNumberOfBytesTransferred);    if (!NT_SUCCESS(Status))    {        /* Convert the error and fail */        BaseSetLastNTError(Status);        return FALSE;    }    /* Success path */    return TRUE;}
开发者ID:RPG-7,项目名称:reactos,代码行数:28,


示例28: ContinueDebugEvent

/* * @implemented */BOOLWINAPIContinueDebugEvent(IN DWORD dwProcessId,                   IN DWORD dwThreadId,                   IN DWORD dwContinueStatus){    CLIENT_ID ClientId;    NTSTATUS Status;    /* Set the Client ID */    ClientId.UniqueProcess = (HANDLE)dwProcessId;    ClientId.UniqueThread = (HANDLE)dwThreadId;    /* Continue debugging */    Status = DbgUiContinue(&ClientId, dwContinueStatus);    if (!NT_SUCCESS(Status))    {        /* Fail */        BaseSetLastNTError(Status);        return FALSE;    }    /* Remove the process/thread handles */    RemoveHandles(dwProcessId, dwThreadId);    /* Success */    return TRUE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:31,


示例29: QueryMemoryResourceNotification

/* * @implemented */BOOLWINAPIQueryMemoryResourceNotification(IN HANDLE ResourceNotificationHandle,                                OUT PBOOL ResourceState){    EVENT_BASIC_INFORMATION EventInfo;    NTSTATUS Status;    if ((ResourceNotificationHandle) &&        (ResourceNotificationHandle != INVALID_HANDLE_VALUE) &&        (ResourceState))    {        Status = NtQueryEvent(ResourceNotificationHandle,                              EventBasicInformation,                              &EventInfo,                              sizeof(EventInfo),                              NULL);        if (NT_SUCCESS(Status))        {            *ResourceState = (EventInfo.EventState == 1);            return TRUE;        }        BaseSetLastNTError(Status);    }    else    {        SetLastError(ERROR_INVALID_PARAMETER);    }    return FALSE;}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:35,


示例30: DeactivateActCtx

/* * @implemented */BOOLWINAPIDeactivateActCtx(IN DWORD dwFlags,                 IN ULONG_PTR ulCookie){    ULONG NativeFlags;    /* Check if the flags are invalid */    if ((dwFlags & ~DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION) != 0)    {        /* Set error and bail out */        BaseSetLastNTError(STATUS_INVALID_PARAMETER);        return FALSE;    }    /* Convert flags */    NativeFlags = 0;    if (dwFlags & DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION)    {        NativeFlags = RTL_DEACTIVATE_ACTIVATION_CONTEXT_FLAG_FORCE_EARLY_DEACTIVATION;    }    /* Call the native API -- it can never fail */    RtlDeactivateActivationContext(NativeFlags, ulCookie);    return TRUE;}
开发者ID:Strongc,项目名称:reactos,代码行数:29,



注:本文中的BaseSetLastNTError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ BaseType函数代码示例
C++ BaseObjectPtr函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。