本文整理汇总了C++中NtClose函数的典型用法代码示例。如果您正苦于以下问题:C++ NtClose函数的具体用法?C++ NtClose怎么用?C++ NtClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NtClose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IniCacheLoad
NTSTATUS
IniCacheLoad(
PINICACHE *Cache,
PWCHAR FileName,
BOOLEAN String)
{
UNICODE_STRING Name;
OBJECT_ATTRIBUTES ObjectAttributes;
FILE_STANDARD_INFORMATION FileInfo;
IO_STATUS_BLOCK IoStatusBlock;
HANDLE FileHandle;
NTSTATUS Status;
PCHAR FileBuffer;
ULONG FileLength;
PCHAR Ptr;
LARGE_INTEGER FileOffset;
PINICACHESECTION Section;
PINICACHEKEY Key;
PCHAR SectionName;
ULONG SectionNameSize;
PCHAR KeyName;
ULONG KeyNameSize;
PCHAR KeyValue;
ULONG KeyValueSize;
*Cache = NULL;
/* Open ini file */
RtlInitUnicodeString(&Name, FileName);
InitializeObjectAttributes(&ObjectAttributes,
&Name,
0,
NULL,
NULL);
Status = NtOpenFile(&FileHandle,
GENERIC_READ | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
if (!NT_SUCCESS(Status))
{
DPRINT("NtOpenFile() failed (Status %lx)\n", Status);
return Status;
}
DPRINT("NtOpenFile() successful\n");
/* Query file size */
Status = NtQueryInformationFile(FileHandle,
&IoStatusBlock,
&FileInfo,
sizeof(FILE_STANDARD_INFORMATION),
FileStandardInformation);
if (!NT_SUCCESS(Status))
{
DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status);
NtClose(FileHandle);
return Status;
}
FileLength = FileInfo.EndOfFile.u.LowPart;
DPRINT("File size: %lu\n", FileLength);
/* Allocate file buffer */
FileBuffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
0,
FileLength + 1);
if (FileBuffer == NULL)
{
DPRINT1("RtlAllocateHeap() failed\n");
NtClose(FileHandle);
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Read file */
FileOffset.QuadPart = 0ULL;
Status = NtReadFile(FileHandle,
NULL,
NULL,
NULL,
&IoStatusBlock,
FileBuffer,
FileLength,
&FileOffset,
NULL);
/* Append string terminator */
FileBuffer[FileLength] = 0;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
//.........这里部分代码省略.........
示例2: GetDirectoryAllocationSizeInternal
UINT64 GetDirectoryAllocationSizeInternal(OBJECT_ATTRIBUTES ObjectAttributes, std::map<UINT64, DWORD>& FileMap)
{
HANDLE hFile;
//OBJECT_ATTRIBUTES ObjectAttributes = { sizeof(OBJECT_ATTRIBUTES), hRootDir, (UNICODE_STRING*)&FileName, OBJ_CASE_INSENSITIVE };
IO_STATUS_BLOCK IoStatusBlock;
auto Status = NtOpenFile(&hFile, SYNCHRONIZE | FILE_LIST_DIRECTORY, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_VALID_FLAGS, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT);
if (Status)
return 0;
UINT64 Space = 0;
byte Buffer[sizeof(FILE_FULL_DIR_INFORMATION) + 512];
FILE_FULL_DIR_INFORMATION & FileInfo = *(FILE_FULL_DIR_INFORMATION *)Buffer;
UNICODE_STRING TempFileName = { 0,0,FileInfo.FileName };
Status = -1;
ObjectAttributes.RootDirectory = hFile;
ObjectAttributes.ObjectName = &TempFileName;
FILE_STANDARD_INFORMATION FileStandardInfo;
FILE_INTERNAL_INFORMATION FileInternalInfo;
while (ZwQueryDirectoryFile(hFile, NULL, NULL, NULL, &IoStatusBlock, Buffer, sizeof(Buffer), FileFullDirectoryInformation, -1, NULL, 0) == ERROR_SUCCESS)
{
TempFileName.Length = TempFileName.MaximumLength = FileInfo.FileNameLength;
if (FileInfo.FileAttributes&FILE_ATTRIBUTE_DIRECTORY)
{
if (FileInfo.FileAttributes&FILE_ATTRIBUTE_REPARSE_POINT)
{
if (IsReparseTagNameSurrogate(FileInfo.EaSize))
continue;
}
else
{
if (IsDots(FileInfo.FileName, FileInfo.FileNameLength))
continue;
}
Space += GetDirectoryAllocationSizeInternal(ObjectAttributes, FileMap);
}
else
{
if (NtGetFileId(&ObjectAttributes, &FileStandardInfo, &FileInternalInfo))
continue;
if (FileStandardInfo.NumberOfLinks != 1)
{
auto T = FileMap.insert(std::pair<UINT64, DWORD>(FileInternalInfo.IndexNumber.QuadPart, FileStandardInfo.NumberOfLinks)).first;
if (--(T->second))
continue;
}
Space += FileInfo.AllocationSize.QuadPart;
}
}
NtClose(hFile);
return Space;
}
示例3: GuiInitFrontEnd
//.........这里部分代码省略.........
/* Terminal data allocation */
GuiData = ConsoleAllocHeap(HEAP_ZERO_MEMORY, sizeof(*GuiData));
if (!GuiData)
{
DPRINT1("CONSRV: Failed to create GUI_CONSOLE_DATA\n");
return STATUS_UNSUCCESSFUL;
}
/// /* HACK */ Console->FrontEndIFace.Context = (PVOID)GuiData; /* HACK */
GuiData->Console = Console;
GuiData->ActiveBuffer = Console->ActiveBuffer;
GuiData->hWindow = NULL;
GuiData->IsWindowVisible = GuiInitInfo->IsWindowVisible;
/* The console can be resized */
Console->FixedSize = FALSE;
InitializeCriticalSection(&GuiData->Lock);
/*
* Set up GUI data
*/
RtlCopyMemory(&GuiData->GuiInfo, &GuiInitInfo->TermInfo, sizeof(GuiInitInfo->TermInfo));
/* Initialize the icon handles */
if (GuiInitInfo->hIcon != NULL)
GuiData->hIcon = GuiInitInfo->hIcon;
else
GuiData->hIcon = ghDefaultIcon;
if (GuiInitInfo->hIconSm != NULL)
GuiData->hIconSm = GuiInitInfo->hIconSm;
else
GuiData->hIconSm = ghDefaultIconSm;
ASSERT(GuiData->hIcon && GuiData->hIconSm);
/* Mouse is shown by default with its default cursor shape */
GuiData->hCursor = ghDefaultCursor;
GuiData->MouseCursorRefCount = 0;
/* A priori don't ignore mouse signals */
GuiData->IgnoreNextMouseSignal = FALSE;
/* Initialize HACK FOR CORE-8394. See conwnd.c!OnMouse for more details. */
GuiData->HackCORE8394IgnoreNextMove = FALSE;
/* Close button and the corresponding system menu item are enabled by default */
GuiData->IsCloseButtonEnabled = TRUE;
/* There is no user-reserved menu id range by default */
GuiData->CmdIdLow = GuiData->CmdIdHigh = 0;
/* Initialize the selection */
RtlZeroMemory(&GuiData->Selection, sizeof(GuiData->Selection));
GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION;
RtlZeroMemory(&GuiData->dwSelectionCursor, sizeof(GuiData->dwSelectionCursor));
GuiData->LineSelection = FALSE; // Default to block selection
// TODO: Retrieve the selection mode via the registry.
GuiData->InputThreadId = GuiInitInfo->InputThreadId;
GuiData->WinSta = GuiInitInfo->WinSta;
GuiData->Desktop = GuiInitInfo->Desktop;
/* Finally, finish to initialize the frontend structure */
This->Context = GuiData;
ConsoleFreeHeap(This->Context2);
This->Context2 = NULL;
/*
* We need to wait until the GUI has been fully initialized
* to retrieve custom settings i.e. WindowSize etc...
* Ideally we could use SendNotifyMessage for this but its not
* yet implemented.
*/
NtCreateEvent(&GuiData->hGuiInitEvent, EVENT_ALL_ACCESS,
NULL, SynchronizationEvent, FALSE);
NtCreateEvent(&GuiData->hGuiTermEvent, EVENT_ALL_ACCESS,
NULL, SynchronizationEvent, FALSE);
DPRINT("GUI - Checkpoint\n");
/* Create the terminal window */
PostThreadMessageW(GuiData->InputThreadId, PM_CREATE_CONSOLE, 0, (LPARAM)GuiData);
/* Wait until initialization has finished */
NtWaitForSingleObject(GuiData->hGuiInitEvent, FALSE, NULL);
DPRINT("OK we created the console window\n");
NtClose(GuiData->hGuiInitEvent);
GuiData->hGuiInitEvent = NULL;
/* Check whether we really succeeded in initializing the terminal window */
if (GuiData->hWindow == NULL)
{
DPRINT("GuiInitConsole - We failed at creating a new terminal window\n");
GuiDeinitFrontEnd(This);
return STATUS_UNSUCCESSFUL;
}
return STATUS_SUCCESS;
}
示例4: IsLeLoader
NTSTATUS LeGlobalData::Initialize()
{
BOOL IsLoader;
PLEPEB LePeb;
PLDR_MODULE Ntdll;
PPEB_BASE Peb;
NTSTATUS Status;
NLSTABLEINFO NlsTableInfo;
UNICODE_STRING SystemDirectory, NlsFileName, OemNlsFileName, LangFileName;
PKEY_VALUE_PARTIAL_INFORMATION IndexValue;
IsLoader = IsLeLoader();
Wow64 = Ps::IsWow64Process();
Ntdll = GetNtdllLdrModule();
LOOP_ONCE
{
LePeb = OpenOrCreateLePeb();
if (LePeb == nullptr)
{
ULONG_PTR DefaultACPLength, DefaultLCIDLength, DefaultOEMCPLength;
WCHAR DefaultACP[0x20], DefaultOEMCP[0x20], DefaultLCID[0x20];
PVOID ReloadedNtdll;
PUNICODE_STRING FullDllName;
LePeb = GetLePeb();
InitDefaultLeb(&LePeb->Leb);
FullDllName = &FindLdrModuleByHandle(&__ImageBase)->FullDllName;
CopyMemory(LePeb->LeDllFullPath, FullDllName->Buffer, FullDllName->Length + sizeof(WCHAR));
Status = LoadPeImage(Ntdll->FullDllName.Buffer, &ReloadedNtdll, nullptr, LOAD_PE_IGNORE_RELOC);
if (NT_SUCCESS(Status))
{
PVOID LdrLoadDllAddress;
LdrLoadDllAddress = LookupExportTable(ReloadedNtdll, NTDLL_LdrLoadDll);
LePeb->LdrLoadDllAddress = PtrAdd(LdrLoadDllAddress, PtrOffset(Ntdll->DllBase, ReloadedNtdll));
CopyMemory(LePeb->LdrLoadDllBackup, LdrLoadDllAddress, LDR_LOAD_DLL_BACKUP_SIZE);
LePeb->LdrLoadDllBackupSize = LDR_LOAD_DLL_BACKUP_SIZE;
UnloadPeImage(ReloadedNtdll);
}
DefaultACPLength = (swprintf(DefaultACP, L"%d", LePeb->Leb.AnsiCodePage) + 1) * sizeof(WCHAR);
DefaultOEMCPLength = (swprintf(DefaultOEMCP, L"%d", LePeb->Leb.OemCodePage) + 1) * sizeof(WCHAR);
DefaultLCIDLength = (swprintf(DefaultLCID, L"%d", LePeb->Leb.LocaleID) + 1) * sizeof(WCHAR);
REGISTRY_REDIRECTION_ENTRY64 *Entry, Entries[] =
{
{
{ (ULONG64)HKEY_LOCAL_MACHINE, USTR64(REGPATH_CODEPAGE), USTR64(REGKEY_ACP), REG_SZ, },
{ (ULONG64)HKEY_LOCAL_MACHINE, USTR64(REGPATH_CODEPAGE), USTR64(REGKEY_ACP), REG_SZ, DefaultACP, DefaultACPLength },
},
{
{ (ULONG64)HKEY_LOCAL_MACHINE, USTR64(REGPATH_CODEPAGE), USTR64(REGKEY_OEMCP), REG_SZ, },
{ (ULONG64)HKEY_LOCAL_MACHINE, USTR64(REGPATH_CODEPAGE), USTR64(REGKEY_OEMCP), REG_SZ, DefaultOEMCP, DefaultOEMCPLength },
},
{
{ (ULONG64)HKEY_LOCAL_MACHINE, USTR64(REGPATH_LANGUAGE), USTR64(REGKEY_DEFAULT_LANGUAGE), REG_SZ, },
{ (ULONG64)HKEY_LOCAL_MACHINE, USTR64(REGPATH_LANGUAGE), USTR64(REGKEY_DEFAULT_LANGUAGE), REG_SZ, DefaultLCID, DefaultLCIDLength },
},
};
Status = this->InitRegistryRedirection(Entries, countof(Entries), nullptr);
}
else
{
*GetLePeb() = *LePeb;
Status = this->InitRegistryRedirection(LePeb->Leb.RegistryReplacement, LePeb->Leb.NumberOfRegistryRedirectionEntries, &LePeb->Leb);
NtClose(LePeb->Section);
CloseLePeb(LePeb);
}
if (IsLoader)
break;
Status = this->TextMetricCache.Initialize();
FAIL_RETURN(Status);
PVOID NlsBaseAddress;
LCID DefaultLocaleID;
LARGE_INTEGER DefaultCasingTableSize;
Status = NtInitializeNlsFiles(&NlsBaseAddress, &DefaultLocaleID, &DefaultCasingTableSize);
FAIL_RETURN(Status);
this->GetLePeb()->OriginalLocaleID = DefaultLocaleID;
NtUnmapViewOfSection(CurrentProcess, NlsBaseAddress);
WriteLog(L"init leb %s", GetLePeb()->LeDllFullPath);
SystemDirectory = Ntdll->FullDllName;
SystemDirectory.Length -= Ntdll->BaseDllName.Length;
Status = RtlDuplicateUnicodeString(RTL_DUPSTR_ADD_NULL, &SystemDirectory, &this->SystemDirectory);
//.........这里部分代码省略.........
示例5: NtCopyDirectory
NTSTATUS NtCopyDirectory(OBJECT_ATTRIBUTES ExistingDirectoryPath, OBJECT_ATTRIBUTES NewDirectoryPath)
{
HANDLE hExistingFile;
//OBJECT_ATTRIBUTES ObjectAttributes = { sizeof(OBJECT_ATTRIBUTES), hRootDir, (UNICODE_STRING*)&FileName, OBJ_CASE_INSENSITIVE };
IO_STATUS_BLOCK IoStatusBlock;
auto Status = NtOpenFile(&hExistingFile, SYNCHRONIZE | FILE_LIST_DIRECTORY| FILE_READ_ATTRIBUTES, &ExistingDirectoryPath, &IoStatusBlock, FILE_SHARE_VALID_FLAGS, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT);
if (Status)
return Status;
HANDLE hNewFile;
Status = NtCreateFile(&hNewFile, SYNCHRONIZE | FILE_LIST_DIRECTORY| FILE_WRITE_ATTRIBUTES, &NewDirectoryPath, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_VALID_FLAGS, FILE_OPEN_IF, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT, NULL, NULL);
if (Status == 0)
{
byte Buffer[sizeof(FILE_FULL_DIR_INFORMATION) + 512];
FILE_FULL_DIR_INFORMATION & FileInfo = *(FILE_FULL_DIR_INFORMATION *)Buffer;
UNICODE_STRING TempFileName = { 0,0,FileInfo.FileName };
NewDirectoryPath.RootDirectory = hNewFile;
ExistingDirectoryPath.RootDirectory = hExistingFile;
ExistingDirectoryPath.ObjectName = NewDirectoryPath.ObjectName = &TempFileName;
byte FileBuffer[1024];
FILE_BASIC_INFORMATION BaseInfo;
while (ZwQueryDirectoryFile(hExistingFile, NULL, NULL, NULL, &IoStatusBlock, Buffer, sizeof(Buffer), FileFullDirectoryInformation, -1, NULL, 0) == ERROR_SUCCESS)
{
TempFileName.Length = TempFileName.MaximumLength = FileInfo.FileNameLength;
if (FileInfo.FileAttributes&FILE_ATTRIBUTE_DIRECTORY)
{
if (IsDots(FileInfo.FileName, FileInfo.FileNameLength))
continue;
Status = NtCopyDirectory(ExistingDirectoryPath, NewDirectoryPath);
}
else
{
HANDLE hExistingFile;
Status = NtOpenFile(&hExistingFile, FILE_GENERIC_READ, &ExistingDirectoryPath, &IoStatusBlock, FILE_SHARE_READ | FILE_SHARE_DELETE, FILE_SEQUENTIAL_ONLY | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT);
if (Status)
break;
HANDLE hNewFile;
Status = NtCreateFile(&hNewFile, SYNCHRONIZE | FILE_GENERIC_WRITE, &NewDirectoryPath, &IoStatusBlock, NULL, FileInfo.FileAttributes, FILE_SHARE_READ, FILE_OVERWRITE_IF, FILE_SEQUENTIAL_ONLY | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT, NULL, NULL);
if (Status)
{
NtClose(hExistingFile);
break;
}
DWORD cbData;
while (true)
{
if (!ReadFile(hExistingFile, FileBuffer, sizeof(FileBuffer), &cbData, NULL))
{
Status = GetLastError_s();
break;
}
if (!cbData)
break;
WriteFile(hNewFile, FileBuffer, cbData, &cbData, NULL);
}
if (NtQueryInformationFile(hExistingFile, &IoStatusBlock, &BaseInfo, sizeof(BaseInfo), FileBasicInformation)==0)
{
NtSetInformationFile(hNewFile,&IoStatusBlock, &BaseInfo, sizeof(BaseInfo), FileBasicInformation);
}
NtClose(hNewFile);
NtClose(hExistingFile);
}
}
if (NtQueryInformationFile(hExistingFile, &IoStatusBlock, &BaseInfo, sizeof(BaseInfo), FileBasicInformation) == 0)
{
NtSetInformationFile(hNewFile, &IoStatusBlock, &BaseInfo, sizeof(BaseInfo), FileBasicInformation);
}
NtClose(hNewFile);
}
NtClose(hExistingFile);
return Status;
}
示例6: RtlCreateUserThread
/***********************************************************************
* RtlCreateUserThread ([email protected])
*/
NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *descr,
BOOLEAN suspended, PVOID stack_addr,
SIZE_T stack_reserve, SIZE_T stack_commit,
PRTL_THREAD_START_ROUTINE start, void *param,
HANDLE *handle_ptr, CLIENT_ID *id )
{
sigset_t sigset;
pthread_t pthread_id;
pthread_attr_t attr;
struct ntdll_thread_data *thread_data;
struct startup_info *info = NULL;
HANDLE handle = 0;
TEB *teb = NULL;
DWORD tid = 0;
int request_pipe[2];
NTSTATUS status;
if (process != NtCurrentProcess())
{
apc_call_t call;
apc_result_t result;
memset( &call, 0, sizeof(call) );
call.create_thread.type = APC_CREATE_THREAD;
call.create_thread.func = wine_server_client_ptr( start );
call.create_thread.arg = wine_server_client_ptr( param );
call.create_thread.reserve = stack_reserve;
call.create_thread.commit = stack_commit;
call.create_thread.suspend = suspended;
status = NTDLL_queue_process_apc( process, &call, &result );
if (status != STATUS_SUCCESS) return status;
if (result.create_thread.status == STATUS_SUCCESS)
{
if (id) id->UniqueThread = ULongToHandle(result.create_thread.tid);
if (handle_ptr) *handle_ptr = wine_server_ptr_handle( result.create_thread.handle );
else NtClose( wine_server_ptr_handle( result.create_thread.handle ));
}
return result.create_thread.status;
}
if (server_pipe( request_pipe ) == -1) return STATUS_TOO_MANY_OPENED_FILES;
wine_server_send_fd( request_pipe[0] );
SERVER_START_REQ( new_thread )
{
req->access = THREAD_ALL_ACCESS;
req->attributes = 0; /* FIXME */
req->suspend = suspended;
req->request_fd = request_pipe[0];
if (!(status = wine_server_call( req )))
{
handle = wine_server_ptr_handle( reply->handle );
tid = reply->tid;
}
close( request_pipe[0] );
}
SERVER_END_REQ;
if (status)
{
close( request_pipe[1] );
return status;
}
pthread_sigmask( SIG_BLOCK, &server_block_set, &sigset );
if ((status = signal_alloc_thread( &teb ))) goto error;
teb->Peb = NtCurrentTeb()->Peb;
teb->ClientId.UniqueProcess = ULongToHandle(GetCurrentProcessId());
teb->ClientId.UniqueThread = ULongToHandle(tid);
teb->StaticUnicodeString.Buffer = teb->StaticUnicodeBuffer;
teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer);
info = (struct startup_info *)(teb + 1);
info->teb = teb;
info->entry_point = start;
info->entry_arg = param;
thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
thread_data->request_fd = request_pipe[1];
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
if ((status = virtual_alloc_thread_stack( teb, stack_reserve, stack_commit ))) goto error;
pthread_attr_init( &attr );
pthread_attr_setstack( &attr, teb->DeallocationStack,
(char *)teb->Tib.StackBase - (char *)teb->DeallocationStack );
pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); /* force creating a kernel thread */
interlocked_xchg_add( &nb_threads, 1 );
if (pthread_create( &pthread_id, &attr, (void * (*)(void *))start_thread, info ))
{
interlocked_xchg_add( &nb_threads, -1 );
//.........这里部分代码省略.........
示例7: winx_get_drive_type
/**
* @brief A Win32 GetDriveType() native equivalent.
* @param[in] letter the volume letter
* @return The drive type, negative value indicates failure.
*/
int winx_get_drive_type(char letter)
{
wchar_t link_name[] = L"\\??\\A:";
#define MAX_TARGET_LENGTH 256
wchar_t link_target[MAX_TARGET_LENGTH];
PROCESS_DEVICEMAP_INFORMATION pdi;
FILE_FS_DEVICE_INFORMATION ffdi;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
int drive_type;
HANDLE hRoot;
/* The additional checks for DFS were suggested by Stefan Pendl ([email protected]). */
/* DFS shares have DRIVE_NO_ROOT_DIR type though they are actually remote. */
letter = winx_toupper(letter);
if(letter < 'A' || letter > 'Z'){
etrace("invalid letter %c",letter);
return (-1);
}
/* check for the drive existence */
link_name[4] = (wchar_t)letter;
if(winx_query_symbolic_link(link_name,link_target,MAX_TARGET_LENGTH) < 0)
return (-1);
/* check for an assignment made by subst command */
if(wcsstr(link_target,L"\\??\\") == (wchar_t *)link_target)
return DRIVE_ASSIGNED_BY_SUBST_COMMAND;
/* check for classical floppies */
if(wcsstr(link_target,L"Floppy"))
return DRIVE_REMOVABLE;
/* try to define exactly which type has the specified drive */
RtlZeroMemory(&pdi,sizeof(PROCESS_DEVICEMAP_INFORMATION));
status = NtQueryInformationProcess(NtCurrentProcess(),
ProcessDeviceMap,&pdi,
sizeof(PROCESS_DEVICEMAP_INFORMATION),
NULL);
if(NT_SUCCESS(status)){
drive_type = (int)pdi.Query.DriveType[letter - 'A'];
/*
* Type DRIVE_NO_ROOT_DIR have the following drives:
* 1. assigned by subst command
* 2. SCSI external drives
* 3. RAID volumes
* 4. DFS shares
* We need additional checks to know exactly.
*/
if(drive_type != DRIVE_NO_ROOT_DIR)
return drive_type;
} else {
strace(status,"cannot get device map");
return (-1);
}
/* try to define exactly again which type has the specified drive */
/* note that the drive motor can be powered on during this check */
hRoot = OpenRootDirectory(letter);
if(hRoot == NULL)
return (-1);
RtlZeroMemory(&ffdi,sizeof(FILE_FS_DEVICE_INFORMATION));
status = NtQueryVolumeInformationFile(hRoot,&iosb,
&ffdi,sizeof(FILE_FS_DEVICE_INFORMATION),
FileFsDeviceInformation);
NtClose(hRoot);
if(!NT_SUCCESS(status)){
strace(status,"cannot get volume type for \'%c\'",letter);
return (-1);
}
/* detect remote/cd/dvd/unknown drives */
if(ffdi.Characteristics & FILE_REMOTE_DEVICE)
return DRIVE_REMOTE;
switch(ffdi.DeviceType){
case FILE_DEVICE_CD_ROM:
case FILE_DEVICE_CD_ROM_FILE_SYSTEM:
case FILE_DEVICE_DVD:
return DRIVE_CDROM;
case FILE_DEVICE_NETWORK_FILE_SYSTEM:
case FILE_DEVICE_NETWORK: /* ? */
case FILE_DEVICE_NETWORK_BROWSER: /* ? */
case FILE_DEVICE_DFS_FILE_SYSTEM:
case FILE_DEVICE_DFS_VOLUME:
case FILE_DEVICE_DFS:
return DRIVE_REMOTE;
case FILE_DEVICE_UNKNOWN:
return DRIVE_UNKNOWN;
}
/* detect removable disks */
if(ffdi.Characteristics & FILE_REMOVABLE_MEDIA)
return DRIVE_REMOVABLE;
//.........这里部分代码省略.........
示例8: RemoveRamDisk
VOID
RemoveRamDisk()
{
WCHAR mountPoint[] = L" :"/*, cDriveLetter = 0*/;
VOID *deviceHandle = 0;
IO_STATUS_BLOCK isb;
RAMDISK_CREATE_DATA createData = { 0 };
deviceHandle = OpenRamDisk();
if (deviceHandle == INVALID_HANDLE_VALUE)
return;
/*cDriveLetter = GetRamDiskDriveLetter(
deviceHandle
);*/
R0QueryRamDisk(deviceHandle, &createData);
/*if(cDriveLetter == 0)
return;*/
if (createData.DriveLetter == NULL)
//could not get a drive letter, return.
return;
//szMountPoint[0] = cDriveLetter;
mountPoint[0] = createData.DriveLetter;
FlushFileBuffers(deviceHandle);
NtDeviceIoControlFile(
deviceHandle,
NULL,
NULL,
NULL,
&isb,
FSCTL_LOCK_VOLUME,
NULL,
NULL,
NULL,
NULL
);
NtDeviceIoControlFile(
deviceHandle,
NULL,
NULL,
NULL,
&isb,
FSCTL_DISMOUNT_VOLUME,
NULL,
NULL,
NULL,
NULL
);
NtDeviceIoControlFile(
deviceHandle,
NULL,
NULL,
NULL,
&isb,
IOCTL_STORAGE_EJECT_MEDIA,
NULL,
NULL,
NULL,
NULL
);
NtDeviceIoControlFile(
deviceHandle,
NULL,
NULL,
NULL,
&isb,
FSCTL_UNLOCK_VOLUME,
NULL,
NULL,
NULL,
NULL
);
//CloseHandle(DeviceHandle);
NtClose(deviceHandle);
DefineDosDeviceW(DDD_REMOVE_DEFINITION,
mountPoint,
NULL);
}
示例9: CheckTokenMembership
/*
* @implemented
*/
BOOL WINAPI
CheckTokenMembership(IN HANDLE ExistingTokenHandle,
IN PSID SidToCheck,
OUT PBOOL IsMember)
{
PISECURITY_DESCRIPTOR SecurityDescriptor = NULL;
ACCESS_MASK GrantedAccess;
struct
{
PRIVILEGE_SET PrivilegeSet;
LUID_AND_ATTRIBUTES Privileges[4];
} PrivBuffer;
ULONG PrivBufferSize = sizeof(PrivBuffer);
GENERIC_MAPPING GenericMapping =
{
STANDARD_RIGHTS_READ,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE,
STANDARD_RIGHTS_ALL
};
PACL Dacl;
ULONG SidLen;
HANDLE hToken = NULL;
NTSTATUS Status, AccessStatus;
/* doesn't return gracefully if IsMember is NULL! */
*IsMember = FALSE;
SidLen = RtlLengthSid(SidToCheck);
if (ExistingTokenHandle == NULL)
{
Status = NtOpenThreadToken(NtCurrentThread(),
TOKEN_QUERY,
FALSE,
&hToken);
if (Status == STATUS_NO_TOKEN)
{
/* we're not impersonating, open the primary token */
Status = NtOpenProcessToken(NtCurrentProcess(),
TOKEN_QUERY | TOKEN_DUPLICATE,
&hToken);
if (NT_SUCCESS(Status))
{
HANDLE hNewToken = FALSE;
BOOL DupRet;
/* duplicate the primary token to create an impersonation token */
DupRet = DuplicateTokenEx(hToken,
TOKEN_QUERY | TOKEN_IMPERSONATE,
NULL,
SecurityImpersonation,
TokenImpersonation,
&hNewToken);
NtClose(hToken);
if (!DupRet)
{
WARN("Failed to duplicate the primary token!\n");
return FALSE;
}
hToken = hNewToken;
}
}
if (!NT_SUCCESS(Status))
{
goto Cleanup;
}
}
else
{
hToken = ExistingTokenHandle;
}
/* create a security descriptor */
SecurityDescriptor = RtlAllocateHeap(RtlGetProcessHeap(),
0,
sizeof(SECURITY_DESCRIPTOR) +
sizeof(ACL) + SidLen +
sizeof(ACCESS_ALLOWED_ACE));
if (SecurityDescriptor == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
goto Cleanup;
}
Status = RtlCreateSecurityDescriptor(SecurityDescriptor,
SECURITY_DESCRIPTOR_REVISION);
if (!NT_SUCCESS(Status))
{
goto Cleanup;
}
//.........这里部分代码省略.........
示例10: PhSvcApiPortInitialization
NTSTATUS PhSvcApiPortInitialization(
_In_ PUNICODE_STRING PortName
)
{
static SID_IDENTIFIER_AUTHORITY ntAuthority = SECURITY_NT_AUTHORITY;
NTSTATUS status;
OBJECT_ATTRIBUTES objectAttributes;
PSECURITY_DESCRIPTOR securityDescriptor;
ULONG sdAllocationLength;
UCHAR administratorsSidBuffer[FIELD_OFFSET(SID, SubAuthority) + sizeof(ULONG) * 2];
PSID administratorsSid;
PACL dacl;
ULONG i;
HANDLE threadHandle;
// Create the API port.
administratorsSid = (PSID)administratorsSidBuffer;
RtlInitializeSid(administratorsSid, &ntAuthority, 2);
*RtlSubAuthoritySid(administratorsSid, 0) = SECURITY_BUILTIN_DOMAIN_RID;
*RtlSubAuthoritySid(administratorsSid, 1) = DOMAIN_ALIAS_RID_ADMINS;
sdAllocationLength = SECURITY_DESCRIPTOR_MIN_LENGTH +
(ULONG)sizeof(ACL) +
(ULONG)sizeof(ACCESS_ALLOWED_ACE) +
RtlLengthSid(administratorsSid) +
(ULONG)sizeof(ACCESS_ALLOWED_ACE) +
RtlLengthSid(&PhSeEveryoneSid);
securityDescriptor = PhAllocate(sdAllocationLength);
dacl = (PACL)((PCHAR)securityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
RtlCreateSecurityDescriptor(securityDescriptor, SECURITY_DESCRIPTOR_REVISION);
RtlCreateAcl(dacl, sdAllocationLength - SECURITY_DESCRIPTOR_MIN_LENGTH, ACL_REVISION);
RtlAddAccessAllowedAce(dacl, ACL_REVISION, PORT_ALL_ACCESS, administratorsSid);
RtlAddAccessAllowedAce(dacl, ACL_REVISION, PORT_CONNECT, &PhSeEveryoneSid);
RtlSetDaclSecurityDescriptor(securityDescriptor, TRUE, dacl, FALSE);
InitializeObjectAttributes(
&objectAttributes,
PortName,
OBJ_CASE_INSENSITIVE,
NULL,
securityDescriptor
);
status = NtCreatePort(
&PhSvcApiPortHandle,
&objectAttributes,
sizeof(PHSVC_API_CONNECTINFO),
PhIsExecutingInWow64() ? sizeof(PHSVC_API_MSG64) : sizeof(PHSVC_API_MSG),
0
);
PhFree(securityDescriptor);
if (!NT_SUCCESS(status))
return status;
// Start the API threads.
PhSvcApiThreadContextTlsIndex = TlsAlloc();
for (i = 0; i < 2; i++)
{
threadHandle = PhCreateThread(0, PhSvcApiRequestThreadStart, NULL);
if (threadHandle)
NtClose(threadHandle);
}
return status;
}
示例11: rtDirNativeOpen
int rtDirNativeOpen(PRTDIRINTERNAL pDir, uintptr_t hRelativeDir, void *pvNativeRelative)
{
/*
* Convert the filter to UTF-16.
*/
int rc;
pDir->pNtFilterStr = NULL;
if ( pDir->cchFilter > 0
&& pDir->enmFilter == RTDIRFILTER_WINNT)
{
PRTUTF16 pwszTmp;
rc = RTStrToUtf16(pDir->pszFilter, &pwszTmp);
if (RT_FAILURE(rc))
return rc;
pDir->NtFilterStr.Buffer = pwszTmp;
pDir->NtFilterStr.Length = pDir->NtFilterStr.MaximumLength = (uint16_t)(RTUtf16Len(pwszTmp) * sizeof(RTUTF16));
pDir->pNtFilterStr = &pDir->NtFilterStr;
}
/*
* Try open the directory
*/
#ifdef IPRT_WITH_NT_PATH_PASSTHRU
bool fObjDir = false;
#endif
if (hRelativeDir != ~(uintptr_t)0 && pvNativeRelative == NULL)
{
/* Caller already opened it, easy! */
pDir->hDir = (HANDLE)hRelativeDir;
rc = VINF_SUCCESS;
}
else
{
/*
* If we have to check for reparse points, this gets complicated!
*/
static int volatile g_fReparsePoints = -1;
uint32_t fOptions = FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT;
int fReparsePoints = g_fReparsePoints;
if ( fReparsePoints != 0
&& (pDir->fFlags & RTDIR_F_NO_FOLLOW)
&& !pDir->fDirSlash)
fOptions |= FILE_OPEN_REPARSE_POINT;
for (;;)
{
if (pvNativeRelative == NULL)
rc = RTNtPathOpenDir(pDir->pszPath,
FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES | FILE_TRAVERSE | SYNCHRONIZE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
fOptions,
OBJ_CASE_INSENSITIVE,
&pDir->hDir,
#ifdef IPRT_WITH_NT_PATH_PASSTHRU
&fObjDir
#else
NULL
#endif
);
else
rc = RTNtPathOpenDirEx((HANDLE)hRelativeDir,
(struct _UNICODE_STRING *)pvNativeRelative,
FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES | FILE_TRAVERSE | SYNCHRONIZE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
fOptions,
OBJ_CASE_INSENSITIVE,
&pDir->hDir,
#ifdef IPRT_WITH_NT_PATH_PASSTHRU
&fObjDir
#else
NULL
#endif
);
if ( !(fOptions & FILE_OPEN_REPARSE_POINT)
|| (rc != VINF_SUCCESS && rc != VERR_INVALID_PARAMETER) )
break;
if (rc == VINF_SUCCESS)
{
if (fReparsePoints == -1)
g_fReparsePoints = 1;
/*
* We now need to check if we opened a symbolic directory link.
* (These can be enumerated, but contains only '.' and '..'.)
*/
FILE_ATTRIBUTE_TAG_INFORMATION TagInfo = { 0, 0 };
IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
NTSTATUS rcNt = NtQueryInformationFile(pDir->hDir, &Ios, &TagInfo, sizeof(TagInfo), FileAttributeTagInformation);
AssertMsg(NT_SUCCESS(rcNt), ("%#x\n", rcNt));
if (!NT_SUCCESS(rcNt))
TagInfo.FileAttributes = TagInfo.ReparseTag = 0;
if (!(TagInfo.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT))
break;
NtClose(pDir->hDir);
pDir->hDir = RTNT_INVALID_HANDLE_VALUE;
if (TagInfo.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
rc = VERR_IS_A_SYMLINK;
//.........这里部分代码省略.........
示例12: InfWriteFile
NTSTATUS
InfWriteFile(HINF InfHandle,
PUNICODE_STRING FileName,
PUNICODE_STRING HeaderComment)
{
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
HANDLE FileHandle;
NTSTATUS Status;
INFSTATUS InfStatus;
PWCHAR Buffer;
ULONG BufferSize;
PWCHAR HeaderBuffer;
ULONG HeaderBufferSize;
UINT Index;
InfStatus = InfpBuildFileBuffer((PINFCACHE) InfHandle, &Buffer, &BufferSize);
if (! INF_SUCCESS(InfStatus))
{
DPRINT("Failed to create buffer (Status 0x%lx)\n", InfStatus);
return InfStatus;
}
/* Open the inf file */
InitializeObjectAttributes(&ObjectAttributes,
FileName,
0,
NULL,
NULL);
Status = NtOpenFile(&FileHandle,
GENERIC_WRITE | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
0,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
if (!INF_SUCCESS(Status))
{
DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
FREE(Buffer);
return Status;
}
DPRINT("NtOpenFile() successful\n");
if (NULL != HeaderComment && 0 != HeaderComment->Length)
{
/* This is just a comment header, don't abort on errors here */
HeaderBufferSize = HeaderComment->Length + 7 * sizeof(WCHAR);
HeaderBuffer = MALLOC(HeaderBufferSize);
if (NULL != HeaderBuffer)
{
strcpyW(HeaderBuffer, L"; ");
for (Index = 0; Index < HeaderComment->Length / sizeof(WCHAR); Index++)
{
HeaderBuffer[2 + Index] = HeaderComment->Buffer[Index];
}
strcpyW(HeaderBuffer + (2 + HeaderComment->Length / sizeof(WCHAR)),
L"\r\n\r\n");
NtWriteFile(FileHandle,
NULL,
NULL,
NULL,
&IoStatusBlock,
HeaderBuffer,
HeaderBufferSize,
NULL,
NULL);
FREE(HeaderBuffer);
}
}
/* Write main contents */
Status = NtWriteFile(FileHandle,
NULL,
NULL,
NULL,
&IoStatusBlock,
Buffer,
BufferSize,
NULL,
NULL);
NtClose(FileHandle);
FREE(Buffer);
if (!INF_SUCCESS(Status))
{
DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
FREE(Buffer);
return(Status);
}
return STATUS_SUCCESS;
}
示例13: PhpServiceGeneralDlgProc
//.........这里部分代码省略.........
HANDLE keyHandle;
PPH_STRING keyName;
keyName = PhConcatStrings(
3,
L"System\\CurrentControlSet\\Services\\",
serviceItem->Name->Buffer,
L"\\Parameters"
);
if (NT_SUCCESS(PhOpenKey(
&keyHandle,
KEY_READ,
PH_KEY_LOCAL_MACHINE,
&keyName->sr,
0
)))
{
PPH_STRING serviceDllString;
if (serviceDllString = PhQueryRegistryString(keyHandle, L"ServiceDll"))
{
PPH_STRING expandedString;
if (expandedString = PhExpandEnvironmentStrings(&serviceDllString->sr))
{
SetDlgItemText(hwndDlg, IDC_SERVICEDLL, expandedString->Buffer);
PhDereferenceObject(expandedString);
}
PhDereferenceObject(serviceDllString);
}
NtClose(keyHandle);
}
PhDereferenceObject(keyName);
}
PhpRefreshControls(hwndDlg);
context->Ready = TRUE;
}
break;
case WM_DESTROY:
{
RemoveProp(hwndDlg, PhMakeContextAtom());
}
break;
case WM_COMMAND:
{
PSERVICE_PROPERTIES_CONTEXT context =
(PSERVICE_PROPERTIES_CONTEXT)GetProp(hwndDlg, PhMakeContextAtom());
switch (LOWORD(wParam))
{
case IDCANCEL:
{
// Workaround for property sheet + multiline edit: http://support.microsoft.com/kb/130765
SendMessage(GetParent(hwndDlg), uMsg, wParam, lParam);
}
break;
case IDC_PASSWORD:
{
if (HIWORD(wParam) == EN_CHANGE)
示例14: IniCacheSave
//.........这里部分代码省略.........
{
BufferSize += wcslen(Key->Name)
+ (Key->Data ? wcslen(Key->Data) : 0)
+ 3; /* "=\r\n" */
Key = Key->Next;
}
Section = Section->Next;
if (Section != NULL)
BufferSize += 2; /* extra "\r\n" at end of each section */
}
BufferSize++; /* Null-terminator */
DPRINT("BufferSize: %lu\n", BufferSize);
/* Allocate file buffer */
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
HEAP_ZERO_MEMORY,
BufferSize);
if (Buffer == NULL)
{
DPRINT1("RtlAllocateHeap() failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Fill file buffer */
Ptr = Buffer;
Section = Cache->FirstSection;
while (Section != NULL)
{
Len = sprintf(Ptr, "[%S]\r\n", Section->Name);
Ptr += Len;
Key = Section->FirstKey;
while (Key != NULL)
{
Len = sprintf(Ptr, "%S=%S\r\n", Key->Name, Key->Data);
Ptr += Len;
Key = Key->Next;
}
Section = Section->Next;
if (Section != NULL)
{
Len = sprintf(Ptr, "\r\n");
Ptr += Len;
}
}
/* Create ini file */
RtlInitUnicodeString(&Name, FileName);
InitializeObjectAttributes(&ObjectAttributes,
&Name,
0,
NULL,
NULL);
Status = NtCreateFile(&FileHandle,
GENERIC_WRITE | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_SUPERSEDE,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY,
NULL,
0);
if (!NT_SUCCESS(Status))
{
DPRINT("NtCreateFile() failed (Status %lx)\n", Status);
RtlFreeHeap(ProcessHeap, 0, Buffer);
return Status;
}
Offset.QuadPart = 0LL;
Status = NtWriteFile(FileHandle,
NULL,
NULL,
NULL,
&IoStatusBlock,
Buffer,
BufferSize,
&Offset,
NULL);
if (!NT_SUCCESS(Status))
{
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
NtClose(FileHandle);
RtlFreeHeap(ProcessHeap, 0, Buffer);
return Status;
}
NtClose(FileHandle);
RtlFreeHeap(ProcessHeap, 0, Buffer);
return STATUS_SUCCESS;
}
示例15: WaitNamedPipeW
//.........这里部分代码省略.........
WARN("Invalid path type\n");
BaseSetLastNTError(STATUS_OBJECT_PATH_SYNTAX_BAD);
return FALSE;
}
/* Now calculate the total length of the structure and allocate it */
WaitPipeInfoSize = FIELD_OFFSET(FILE_PIPE_WAIT_FOR_BUFFER, Name[0]) +
NewName.Length;
WaitPipeInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, WaitPipeInfoSize);
if (WaitPipeInfo == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
/* Initialize the object attributes */
TRACE("Opening: %wZ\n", &DevicePath);
InitializeObjectAttributes(&ObjectAttributes,
&DevicePath,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
/* Open the path */
Status = NtOpenFile(&FileHandle,
FILE_READ_ATTRIBUTES | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS(Status))
{
/* Fail; couldn't open */
WARN("Status: %lx\n", Status);
BaseSetLastNTError(Status);
RtlFreeUnicodeString(&NamedPipeName);
RtlFreeHeap(RtlGetProcessHeap(), 0, WaitPipeInfo);
return FALSE;
}
/* Check what timeout we got */
if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT)
{
/* Don't use a timeout */
WaitPipeInfo->TimeoutSpecified = FALSE;
}
else
{
/* Check if we should wait forever */
if (nTimeOut == NMPWAIT_WAIT_FOREVER)
{
/* Set the max */
WaitPipeInfo->Timeout.LowPart = 0;
WaitPipeInfo->Timeout.HighPart = 0x80000000;
}
else
{
/* Convert to NT format */
WaitPipeInfo->Timeout.QuadPart = UInt32x32To64(-10000, nTimeOut);
}
/* In both cases, we do have a timeout */
WaitPipeInfo->TimeoutSpecified = TRUE;
}
/* Set the length and copy the name */
WaitPipeInfo->NameLength = NewName.Length;
RtlCopyMemory(WaitPipeInfo->Name, NewName.Buffer, NewName.Length);
/* Get rid of the full name */
RtlFreeUnicodeString(&NamedPipeName);
/* Let NPFS know of our request */
Status = NtFsControlFile(FileHandle,
NULL,
NULL,
NULL,
&IoStatusBlock,
FSCTL_PIPE_WAIT,
WaitPipeInfo,
WaitPipeInfoSize,
NULL,
0);
/* Free our pipe info data and close the handle */
RtlFreeHeap(RtlGetProcessHeap(), 0, WaitPipeInfo);
NtClose(FileHandle);
/* Check the status */
if (!NT_SUCCESS(Status))
{
/* Failure to wait on the pipe */
WARN("Status: %lx\n", Status);
BaseSetLastNTError (Status);
return FALSE;
}
/* Success */
return TRUE;
}