diff --git a/reactos/lib/userenv/desktop.c b/reactos/lib/userenv/desktop.c index e6b260d11ac..f842e2a504a 100644 --- a/reactos/lib/userenv/desktop.c +++ b/reactos/lib/userenv/desktop.c @@ -1,4 +1,4 @@ -/* $Id: desktop.c,v 1.3 2004/05/03 12:05:44 ekohl Exp $ +/* $Id: desktop.c,v 1.4 2004/05/04 13:11:22 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -141,7 +141,7 @@ AddDesktopItemA (BOOL bCommonItem, BOOL WINAPI -AddDesktopItemW (BOOL bCommonItem, +AddDesktopItemW (BOOL bCommonDesktop, LPCWSTR lpItemName, LPCWSTR lpArguments, LPCWSTR lpIconLocation, @@ -164,7 +164,7 @@ AddDesktopItemW (BOOL bCommonItem, bResult = FALSE; - if (!GetDesktopPath (bCommonItem, szLinkPath)) + if (!GetDesktopPath (bCommonDesktop, szLinkPath)) { DPRINT1 ("GetDesktopPath() failed\n"); return FALSE; @@ -383,4 +383,68 @@ DeleteGroupW (LPCWSTR lpGroupName, return TRUE; } + +BOOL WINAPI +DeleteItemA (LPCSTR lpGroupName, + BOOL bCommonGroup, + LPCSTR lpItemName, + BOOL bDeleteGroup) +{ + DPRINT1 ("DeleteItemA() not implemented!\n"); + return FALSE; +} + + +BOOL WINAPI +DeleteItemW (LPCWSTR lpGroupName, + BOOL bCommonGroup, + LPCWSTR lpItemName, + BOOL bDeleteGroup) +{ + WCHAR szItemPath[MAX_PATH]; + LPWSTR Ptr; + + DPRINT ("DeleteItemW() called\n"); + + if (!GetProgramsPath (bCommonGroup, szItemPath)) + { + DPRINT1 ("GetProgramsPath() failed\n"); + return FALSE; + } + DPRINT ("Programs path: '%S'\n", szItemPath); + + if (lpGroupName != NULL && *lpGroupName != 0) + { + wcscat (szItemPath, L"\\"); + wcscat (szItemPath, lpGroupName); + } + + wcscat (szItemPath, L"\\"); + wcscat (szItemPath, lpItemName); + wcscat (szItemPath, L".lnk"); + DPRINT ("Item path: '%S'\n", szItemPath); + + if (!DeleteFileW (szItemPath)) + return FALSE; + + /* FIXME: Notify the shell */ + + if (bDeleteGroup) + { + Ptr = wcsrchr (szItemPath, L'\\'); + if (Ptr == NULL) + return TRUE; + + *Ptr = 0; + if (RemoveDirectoryW (szItemPath)) + { + /* FIXME: Notify the shell */ + } + } + + DPRINT ("DeleteItemW() done\n"); + + return TRUE; +} + /* EOF */ diff --git a/reactos/lib/userenv/userenv.def b/reactos/lib/userenv/userenv.def index 0ae996935c2..9e76dec868f 100644 --- a/reactos/lib/userenv/userenv.def +++ b/reactos/lib/userenv/userenv.def @@ -5,6 +5,8 @@ CreateGroupA@8 @101 NONAME CreateGroupW@8 @102 NONAME DeleteGroupA@8 @103 NONAME DeleteGroupW@8 @104 NONAME +DeleteItemA@16 @107 NONAME +DeleteItemW@16 @108 NONAME CreateUserProfileA@8 @109 NONAME CreateUserProfileW@8 @110 NONAME AddDesktopItemA@32 @113 NONAME diff --git a/reactos/lib/userenv/userenv.edf b/reactos/lib/userenv/userenv.edf index d812d7a8633..05b97575bcb 100644 --- a/reactos/lib/userenv/userenv.edf +++ b/reactos/lib/userenv/userenv.edf @@ -5,6 +5,8 @@ CreateGroupA=CreateGroupA@8 @101 NONAME CreateGroupW=CreateGroupW@8 @102 NONAME DeleteGroupA=DeleteGroupA@8 @103 NONAME DeleteGroupW=DeleteGroupW@8 @104 NONAME +DeleteItemA=DeleteItemA@16 @107 NONAME +DeleteItemW=DeleteItemW@16 @108 NONAME CreateUserProfileA=CreateUserProfileA@8 @109 NONAME CreateUserProfileW=CreateUserProfileW@8 @110 NONAME AddDesktopItemA=AddDesktopItemA@32 @113 NONAME diff --git a/reactos/w32api/include/userenv.h b/reactos/w32api/include/userenv.h index 7de9a8bcd36..bd836e92d30 100644 --- a/reactos/w32api/include/userenv.h +++ b/reactos/w32api/include/userenv.h @@ -48,6 +48,8 @@ BOOL WINAPI CreateGroupA (LPCSTR, BOOL); BOOL WINAPI CreateGroupW (LPCWSTR, BOOL); BOOL WINAPI DeleteGroupA (LPCSTR, BOOL); BOOL WINAPI DeleteGroupW (LPCWSTR, BOOL); +BOOL WINAPI DeleteItemA (LPCSTR, BOOL, LPCSTR, BOOL); +BOOL WINAPI DeleteItemW (LPCWSTR, BOOL, LPCWSTR, BOOL); /* end private */ BOOL WINAPI LoadUserProfileA (HANDLE, LPPROFILEINFOA); BOOL WINAPI LoadUserProfileW (HANDLE, LPPROFILEINFOW); @@ -74,6 +76,7 @@ typedef LPPROFILEINFOW LPPROFILEINFO; #define DeleteDesktopItem DeleteDesktopItemW #define CreateGroup CreateGroupW #define DeleteGroup DeleteGroupW +#define DeleteItem DeleteItemW /* end private */ #define LoadUserProfile LoadUserProfileW #define GetAllUsersProfileDirectory GetAllUsersProfileDirectoryW @@ -89,6 +92,7 @@ typedef LPPROFILEINFOA LPPROFILEINFO; #define DeleteDesktopItem DeleteDesktopItemA #define CreateGroup CreateGroupA #define DeleteGroup DeleteGroupA +#define DeleteItem DeleteItemA /* end private */ #define LoadUserProfile LoadUserProfileA #define GetAllUsersProfileDirectory GetAllUsersProfileDirectoryA