Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
defunctec
crown-core
Commits
95b6a4f7
Commit
95b6a4f7
authored
13 years ago
by
Gavin Andresen
Browse files
Options
Download
Plain Diff
Merge branch '2012_02_getspecialfolderpath_overflow' of
https://github.com/laanwj/bitcoin
parents
600dd111
eb195f10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/util.cpp
+10
-33
src/util.cpp
with
10 additions
and
33 deletions
+10
-33
src/util.cpp
View file @
95b6a4f7
...
...
@@ -787,46 +787,23 @@ void PrintExceptionContinue(std::exception* pex, const char* pszThread)
strMiscWarning
=
pszMessage
;
}
#ifdef WIN32
typedef
WINSHELLAPI
BOOL
(
WINAPI
*
PSHGETSPECIALFOLDERPATHA
)(
HWND
hwndOwner
,
LPSTR
lpszPath
,
int
nFolder
,
BOOL
fCreate
);
string
MyGetSpecialFolderPath
(
int
nFolder
,
bool
fCreate
)
{
char
pszPath
[
MAX_PATH
+
100
]
=
""
;
// SHGetSpecialFolderPath isn't always available on old Windows versions
HMODULE
hShell32
=
LoadLibraryA
(
"shell32.dll"
);
if
(
hShell32
)
char
pszPath
[
MAX_PATH
]
=
""
;
if
(
SHGetSpecialFolderPathA
(
NULL
,
pszPath
,
nFolder
,
fCreate
))
{
PSHGETSPECIALFOLDERPATHA
pSHGetSpecialFolderPath
=
(
PSHGETSPECIALFOLDERPATHA
)
GetProcAddress
(
hShell32
,
"SHGetSpecialFolderPathA"
);
if
(
pSHGetSpecialFolderPath
)
(
*
pSHGetSpecialFolderPath
)(
NULL
,
pszPath
,
nFolder
,
fCreate
);
FreeModule
(
hShell32
);
return
pszPath
;
}
// Backup option
if
(
pszPath
[
0
]
==
'\0'
)
else
if
(
nFolder
==
CSIDL_STARTUP
)
{
if
(
nFolder
==
CSIDL_STARTUP
)
{
strcpy
(
pszPath
,
getenv
(
"USERPROFILE"
));
strcat
(
pszPath
,
"
\\
Start Menu
\\
Programs
\\
Startup"
);
}
else
if
(
nFolder
==
CSIDL_APPDATA
)
{
strcpy
(
pszPath
,
getenv
(
"APPDATA"
));
}
return
string
(
getenv
(
"USERPROFILE"
))
+
"
\\
Start Menu
\\
Programs
\\
Startup"
;
}
return
pszPath
;
else
if
(
nFolder
==
CSIDL_APPDATA
)
{
return
getenv
(
"APPDATA"
);
}
return
""
;
}
#endif
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help