ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

NTSTATUS GetSourcePaths ( PUNICODE_STRING  SourcePath,
PUNICODE_STRING  SourceRootPath,
PUNICODE_STRING  SourceRootDir 
)

Definition at line 37 of file drivesup.c.

Referenced by SetupStartPage().

{
  OBJECT_ATTRIBUTES ObjectAttributes;
  UNICODE_STRING LinkName;
  UNICODE_STRING SourceName;
  WCHAR SourceBuffer[MAX_PATH] = {L'\0'};
  HANDLE Handle;
  NTSTATUS Status;
  ULONG Length;
  PWCHAR Ptr;

  RtlInitUnicodeString(&LinkName,
               L"\\SystemRoot");

  InitializeObjectAttributes(&ObjectAttributes,
                 &LinkName,
                 OBJ_CASE_INSENSITIVE,
                 NULL,
                 NULL);

  Status = NtOpenSymbolicLinkObject(&Handle,
                    SYMBOLIC_LINK_ALL_ACCESS,
                    &ObjectAttributes);
  if (!NT_SUCCESS(Status))
    return(Status);

  SourceName.Length = 0;
  SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
  SourceName.Buffer = SourceBuffer;

  Status = NtQuerySymbolicLinkObject(Handle,
                     &SourceName,
                     &Length);
  NtClose(Handle);

  if (NT_SUCCESS(Status))
    {
      RtlCreateUnicodeString(SourcePath,
                             SourceName.Buffer);

      /* strip trailing directory */
      Ptr = wcsrchr(SourceName.Buffer, L'\\');
      if (Ptr)
      {
          RtlCreateUnicodeString(SourceRootDir, Ptr);
          *Ptr = 0;
      }
      else
          RtlCreateUnicodeString(SourceRootDir, L"");

      RtlCreateUnicodeString(SourceRootPath,
                             SourceName.Buffer);
    }

  NtClose(Handle);

  return(STATUS_SUCCESS);
}

Generated on Sat May 26 2012 04:43:38 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.