Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendrivesup.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS kernel 00003 * Copyright (C) 2002 ReactOS Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 /* $Id: drivesup.c 47686 2010-06-07 21:38:49Z spetreolle $ 00020 * COPYRIGHT: See COPYING in the top level directory 00021 * PROJECT: ReactOS text-mode setup 00022 * FILE: subsys/system/usetup/drivesup.c 00023 * PURPOSE: Drive support functions 00024 * PROGRAMMER: Eric Kohl 00025 */ 00026 00027 /* INCLUDES *****************************************************************/ 00028 00029 #include "usetup.h" 00030 00031 #define NDEBUG 00032 #include <debug.h> 00033 00034 /* FUNCTIONS ****************************************************************/ 00035 00036 NTSTATUS 00037 GetSourcePaths(PUNICODE_STRING SourcePath, 00038 PUNICODE_STRING SourceRootPath, 00039 PUNICODE_STRING SourceRootDir) 00040 { 00041 OBJECT_ATTRIBUTES ObjectAttributes; 00042 UNICODE_STRING LinkName; 00043 UNICODE_STRING SourceName; 00044 WCHAR SourceBuffer[MAX_PATH] = {L'\0'}; 00045 HANDLE Handle; 00046 NTSTATUS Status; 00047 ULONG Length; 00048 PWCHAR Ptr; 00049 00050 RtlInitUnicodeString(&LinkName, 00051 L"\\SystemRoot"); 00052 00053 InitializeObjectAttributes(&ObjectAttributes, 00054 &LinkName, 00055 OBJ_CASE_INSENSITIVE, 00056 NULL, 00057 NULL); 00058 00059 Status = NtOpenSymbolicLinkObject(&Handle, 00060 SYMBOLIC_LINK_ALL_ACCESS, 00061 &ObjectAttributes); 00062 if (!NT_SUCCESS(Status)) 00063 return(Status); 00064 00065 SourceName.Length = 0; 00066 SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR); 00067 SourceName.Buffer = SourceBuffer; 00068 00069 Status = NtQuerySymbolicLinkObject(Handle, 00070 &SourceName, 00071 &Length); 00072 NtClose(Handle); 00073 00074 if (NT_SUCCESS(Status)) 00075 { 00076 RtlCreateUnicodeString(SourcePath, 00077 SourceName.Buffer); 00078 00079 /* strip trailing directory */ 00080 Ptr = wcsrchr(SourceName.Buffer, L'\\'); 00081 if (Ptr) 00082 { 00083 RtlCreateUnicodeString(SourceRootDir, Ptr); 00084 *Ptr = 0; 00085 } 00086 else 00087 RtlCreateUnicodeString(SourceRootDir, L""); 00088 00089 RtlCreateUnicodeString(SourceRootPath, 00090 SourceName.Buffer); 00091 } 00092 00093 NtClose(Handle); 00094 00095 return(STATUS_SUCCESS); 00096 } 00097 00098 00099 /* EOF */ Generated on Wed May 23 2012 04:16:08 for ReactOS by
1.7.6.1
|