• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BaseSetLastNTError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetTimeZoneInformation

/*
 * @implemented
 */
BOOL
WINAPI
SetTimeZoneInformation(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,代码来源:timezone.c


示例2: GetCurrentActCtx

/*
 * @implemented
 */
BOOL
WINAPI
GetCurrentActCtx(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,代码来源:actctx.c


示例3: DebugSetProcessKillOnExit

/*
 * @implemented
 */
BOOL
WINAPI
DebugSetProcessKillOnExit(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,代码来源:debugger.c


示例4: ActivateActCtx

/*
 * @implemented
 */
BOOL
WINAPI
ActivateActCtx(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,代码来源:actctx.c


示例5: QueryFullProcessImageNameW

/*
 * @implemented
 */
BOOL
WINAPI
QueryFullProcessImageNameW(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,代码来源:vista.c


示例6: MoveFileExA

BOOL
APIENTRY
MoveFileExA(
    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,代码来源:filemisc.c


示例7: SetTimeZoneInformation

/*
 * @implemented
 */
BOOL
WINAPI
SetTimeZoneInformation(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,代码来源:timezone.c


示例8: GetQueuedCompletionStatus

/*
 * @implemented
 */
BOOL
WINAPI
GetQueuedCompletionStatus(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,代码来源:iocompl.c


示例9: LockFileEx

/*
 * @implemented
 */
BOOL
WINAPI
LockFileEx(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,代码来源:lock.c


示例10: CreateToolhelp32Snapshot

/*
 * @implemented
 */
HANDLE
WINAPI
CreateToolhelp32Snapshot(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,代码来源:toolhelp.c


示例11: LockFile

/*
 * @implemented
 */
BOOL
WINAPI
LockFile(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,代码来源:lock.c


示例12: GetProcAddress

/*
 * @implemented
 */
FARPROC
WINAPI
GetProcAddress(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,代码来源:loader.c


示例13: DuplicateHandle

/*
 * @implemented
 */
BOOL
WINAPI
DuplicateHandle(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,代码来源:handle.c


示例14: SetHandleInformation

/*
 * @implemented
 */
BOOL
WINAPI
SetHandleInformation(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,代码来源:handle.c


示例15: GetCompressedFileSizeA

DWORD
WINAPI
GetCompressedFileSizeA(
    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,代码来源:filemisc.c


示例16: SleepConditionVariableSRW

/*
 * @implemented
 */
BOOL
WINAPI
SleepConditionVariableSRW(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,代码来源:vista.c


示例17: SleepConditionVariableCS

/*
 * @implemented
 */
BOOL
WINAPI
SleepConditionVariableCS(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,代码来源:vista.c


示例18: GetConsoleAliasExesLengthW

/*
 * @implemented
 */
DWORD
WINAPI
GetConsoleAliasExesLengthW(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,代码来源:alias.c


示例19: ReadFileEx

/*
 * @implemented
 */
BOOL WINAPI
ReadFileEx(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,代码来源:rw.c


示例20: GetLogicalProcessorInformation

/*
 * @implemented
 */
BOOL
WINAPI
GetLogicalProcessorInformation(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,代码来源:sysinfo.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BaseType函数代码示例发布时间:2022-05-30
下一篇:
C++ BaseObjectPtr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap