xref: /trunk/main/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*32b1fd08SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*32b1fd08SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*32b1fd08SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*32b1fd08SAndrew Rist  * distributed with this work for additional information
6*32b1fd08SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*32b1fd08SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*32b1fd08SAndrew Rist  * "License"); you may not use this file except in compliance
9*32b1fd08SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*32b1fd08SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*32b1fd08SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*32b1fd08SAndrew Rist  * software distributed under the License is distributed on an
15*32b1fd08SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*32b1fd08SAndrew Rist  * KIND, either express or implied.  See the License for the
17*32b1fd08SAndrew Rist  * specific language governing permissions and limitations
18*32b1fd08SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*32b1fd08SAndrew Rist  *************************************************************/
21*32b1fd08SAndrew Rist 
22*32b1fd08SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifdef _MSC_VER
25cdf0e10cSrcweir #pragma warning(push, 1) /* disable warnings within system headers */
26cdf0e10cSrcweir #pragma warning(disable: 4917)
27cdf0e10cSrcweir #endif
28cdf0e10cSrcweir #define WIN32_LEAN_AND_MEAN
29cdf0e10cSrcweir #include <windows.h>
30cdf0e10cSrcweir #include <shlobj.h>
31cdf0e10cSrcweir #include <msiquery.h>
32cdf0e10cSrcweir #ifdef _MSC_VER
33cdf0e10cSrcweir #pragma warning(pop)
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <string>
37cdf0e10cSrcweir #include "quickstarter.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
RemoveQuickstarterLink(MSIHANDLE hMSI)40cdf0e10cSrcweir extern "C" UINT __stdcall RemoveQuickstarterLink( MSIHANDLE hMSI )
41cdf0e10cSrcweir {
42cdf0e10cSrcweir     CHAR    szStartupPath[MAX_PATH];
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     if ( SHGetSpecialFolderPathA( NULL, szStartupPath, CSIDL_STARTUP, FALSE ) )
45cdf0e10cSrcweir     {
46cdf0e10cSrcweir         std::string sQuickstartLinkPath = szStartupPath;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir         sQuickstartLinkPath += "\\";
49cdf0e10cSrcweir         sQuickstartLinkPath += GetQuickstarterLinkName( hMSI );
50cdf0e10cSrcweir         sQuickstartLinkPath += ".lnk";
51cdf0e10cSrcweir 
52cdf0e10cSrcweir         DeleteFileA( sQuickstartLinkPath.c_str() );
53cdf0e10cSrcweir     }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     return ERROR_SUCCESS;
56cdf0e10cSrcweir }
57