Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenchdrive.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS system libraries 00004 * FILE: lib/crt/chdrive.c 00005 * PURPOSE: Change the current drive. 00006 * PROGRAMER: WINE 00007 * UPDATE HISTORY: 00008 * 25/11/05: Added license header 00009 */ 00010 00011 #include <precomp.h> 00012 00013 /* 00014 * @implemented 00015 * 00016 * _chdrive (MSVCRT.@) 00017 * 00018 * Change the current drive. 00019 * 00020 * PARAMS 00021 * newdrive [I] Drive number to change to (1 = 'A', 2 = 'B', ...) 00022 * 00023 * RETURNS 00024 * Success: 0. The current drive is set to newdrive. 00025 * Failure: -1. errno indicates the error. 00026 * 00027 * NOTES 00028 * See SetCurrentDirectoryA. 00029 */ 00030 int _chdrive(int newdrive) 00031 { 00032 WCHAR buffer[] = L"A:"; 00033 00034 buffer[0] += newdrive - 1; 00035 if (!SetCurrentDirectoryW( buffer )) 00036 { 00037 _dosmaperr(GetLastError()); 00038 if (newdrive <= 0) 00039 { 00040 _set_errno(EACCES); 00041 } 00042 return -1; 00043 } 00044 return 0; 00045 } Generated on Sun May 27 2012 04:36:27 for ReactOS by
1.7.6.1
|