ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/NSISPlugins/ShellFolder/ShellFolder.cpp
Revision: 1174
Committed: 2009-05-16T19:49:03-07:00 (16 years, 1 month ago) by douglas
File size: 742 byte(s)
Log Message:
Shell Folder Plugin.

File Contents

# Content
1 // NSIS Shell Folder Plugin
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #include <Windows.h>
8 #include <ShlObj.h>
9 #include <nsis/pluginapi.h>
10
11 extern "C" void __declspec(dllexport) GetFolderPath(HWND parent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
12 {
13 EXDLL_INIT();
14
15 int folder(::popint_or());
16 unsigned long flags(::popint_or());
17 char path[MAX_PATH];
18 long code(::SHGetFolderPath(parent, folder, NULL, flags, path));
19
20 if (SUCCEEDED(code))
21 ::pushstring(path);
22 else
23 switch (code)
24 {
25 case S_FALSE:
26 case E_FAIL:
27 ::pushstring("Folder does not exist.");
28 break;
29 case E_INVALIDARG:
30 ::pushstring("Invalid arguments.");
31 break;
32 default:
33 ::pushstring("Unknown error.");
34 }
35
36 ::pushint(code);
37 }

Properties

Name Value
svn:eol-style native
svn:keywords Id