mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 15:45:00 +00:00
DefineDosDeviceW: implemented the DDD_REMOVE_DEFINITION flag.
This commit is contained in:
parent
115862146a
commit
74f583ed19
|
@ -936,6 +936,8 @@ BOOL WINAPI DefineDosDeviceW( DWORD flags, LPCWSTR devname, LPCWSTR targetpath )
|
|||
BOOL ret = FALSE;
|
||||
char *path = NULL, *target, *p;
|
||||
|
||||
if (!(flags & DDD_REMOVE_DEFINITION))
|
||||
{
|
||||
if (!(flags & DDD_RAW_TARGET_PATH))
|
||||
{
|
||||
FIXME( "(0x%08lx,%s,%s) DDD_RAW_TARGET_PATH flag not set, not supported yet\n",
|
||||
|
@ -955,6 +957,8 @@ BOOL WINAPI DefineDosDeviceW( DWORD flags, LPCWSTR devname, LPCWSTR targetpath )
|
|||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else target = NULL;
|
||||
|
||||
/* first check for a DOS device */
|
||||
|
||||
|
@ -973,14 +977,23 @@ BOOL WINAPI DefineDosDeviceW( DWORD flags, LPCWSTR devname, LPCWSTR targetpath )
|
|||
else SetLastError( ERROR_FILE_NOT_FOUND );
|
||||
|
||||
if (path)
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
TRACE( "creating symlink %s -> %s\n", path, target );
|
||||
unlink( path );
|
||||
if (!symlink( target, path )) ret = TRUE;
|
||||
else FILE_SetDosError();
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE( "removing symlink %s\n", path );
|
||||
if (!unlink( path )) ret = TRUE;
|
||||
else FILE_SetDosError();
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, path );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, target );
|
||||
if (target) HeapFree( GetProcessHeap(), 0, target );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue