Skip to content

Commit

Permalink
Merge pull request #73 from RaiKoHoff/RelaunchElevated
Browse files Browse the repository at this point in the history
Save file: permission denied - Relaunch elevated, keeping changes via temp. buffer file
  • Loading branch information
rizonesoft authored Sep 2, 2017
2 parents 9f8bd5f + 239f54b commit eb6d1b0
Show file tree
Hide file tree
Showing 13 changed files with 316 additions and 116 deletions.
9 changes: 9 additions & 0 deletions crypto/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ optionally with master key
see ecryption-doc.txt for details
*/
#if !defined(WINVER)
#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(NTDDI_VERSION)
#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/
#endif
#define VC_EXTRALEAN 1
#include <windows.h>
#include <intsafe.h>
Expand Down
9 changes: 9 additions & 0 deletions crypto/rijndael-api-fst.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
have been tweaked for compatibility with the local environment.
*/
#if !defined(WINVER)
#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(NTDDI_VERSION)
#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/
#endif
#define VC_EXTRALEAN 1
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
Expand Down
28 changes: 19 additions & 9 deletions src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@
* *
* *
*******************************************************************************/
#if !defined(WINVER)
#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x501
#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(NTDDI_VERSION)
#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/
#endif
#define VC_EXTRALEAN 1
#define WIN32_LEAN_AND_MEAN 1

#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
Expand Down Expand Up @@ -412,7 +419,8 @@ INT_PTR CALLBACK RunDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
PathRemoveFileSpec(wchDirectory);
}

SHELLEXECUTEINFO sei = { 0 };
SHELLEXECUTEINFO sei;
ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = 0;
sei.hwnd = hwnd;
Expand All @@ -423,13 +431,14 @@ INT_PTR CALLBACK RunDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
sei.nShow = SW_SHOWNORMAL;

if (bQuickExit) {
sei.fMask |= /*SEE_MASK_NOZONECHECKS*/0x00800000;
sei.fMask |= SEE_MASK_NOZONECHECKS;
EndDialog(hwnd,IDOK);
CoInitializeEx(NULL,COINIT_APARTMENTTHREADED | COINIT_SPEED_OVER_MEMORY);
ShellExecuteEx(&sei);
}

else {

CoInitializeEx(NULL,COINIT_APARTMENTTHREADED | COINIT_SPEED_OVER_MEMORY);
if (ShellExecuteEx(&sei))
EndDialog(hwnd,IDOK);

Expand Down Expand Up @@ -630,6 +639,7 @@ INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam
//
BOOL OpenWithDlg(HWND hwnd,LPCWSTR lpstrFile)
{
BOOL result = FALSE;

DLITEM dliOpenWith;
dliOpenWith.mask = DLI_FILENAME;
Expand All @@ -645,7 +655,8 @@ BOOL OpenWithDlg(HWND hwnd,LPCWSTR lpstrFile)
PathRemoveFileSpec(wchDirectory);
}

SHELLEXECUTEINFO sei = { 0 };
SHELLEXECUTEINFO sei;
ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = 0;
sei.hwnd = hwnd;
Expand All @@ -661,12 +672,11 @@ BOOL OpenWithDlg(HWND hwnd,LPCWSTR lpstrFile)
//GetShortPathName(szParam,szParam,sizeof(WCHAR)*COUNTOF(szParam));
PathQuoteSpaces(szParam);

ShellExecuteEx(&sei);

return(TRUE);
CoInitializeEx(NULL,COINIT_APARTMENTTHREADED | COINIT_SPEED_OVER_MEMORY);
result = ShellExecuteEx(&sei);
}

return(FALSE);
return result;

}

Expand Down
9 changes: 8 additions & 1 deletion src/Dlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@
* *
* *
*******************************************************************************/
#if !defined(WINVER)
#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x501
#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(NTDDI_VERSION)
#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/
#endif
#define VC_EXTRALEAN 1

#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
Expand Down
29 changes: 28 additions & 1 deletion src/Edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
* *
*******************************************************************************/

#if !defined(WINVER)
#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x501
#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(NTDDI_VERSION)
#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/
#endif
#define VC_EXTRALEAN 1

#include <windows.h>
#include <shlwapi.h>
#include <commctrl.h>
Expand Down Expand Up @@ -77,6 +84,26 @@ char PunctuationCharsDefault[DELIM_BUFFER] = { '\0' };
char WhiteSpaceCharsAccelerated[DELIM_BUFFER] = { '\0' };
char PunctuationCharsAccelerated[DELIM_BUFFER] = { '\0' };

enum AlignMask {
ALIGN_LEFT = 0,
ALIGN_RIGHT = 1,
ALIGN_CENTER = 2,
ALIGN_JUSTIFY = 3,
ALIGN_JUSTIFY_EX = 4
};

enum SortOrderMask {
SORT_ASCENDING = 0,
SORT_DESCENDING = 1,
SORT_SHUFFLE = 2,
SORT_MERGEDUP = 4,
SORT_UNIQDUP = 8,
SORT_UNIQUNIQ = 16,
SORT_NOCASE = 32,
SORT_LOGICAL = 64,
SORT_COLUMN = 128
};

int g_DOSEncoding;

// Supported Encodings
Expand Down
22 changes: 0 additions & 22 deletions src/Edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,6 @@ typedef struct _editfindreplace
#define IDMSG_SWITCHTOFIND 300
#define IDMSG_SWITCHTOREPLACE 301

enum AlignMask
{
ALIGN_LEFT = 0,
ALIGN_RIGHT = 1,
ALIGN_CENTER = 2,
ALIGN_JUSTIFY = 3,
ALIGN_JUSTIFY_EX = 4
};

enum SortOrderMask
{
SORT_ASCENDING = 0,
SORT_DESCENDING = 1,
SORT_SHUFFLE = 2,
SORT_MERGEDUP = 4,
SORT_UNIQDUP = 8,
SORT_UNIQUNIQ = 16,
SORT_NOCASE = 32,
SORT_LOGICAL = 64,
SORT_COLUMN = 128
};

HWND EditCreate(HWND);
void EditInitWordDelimiter(HWND);
void EditSetNewText(HWND,char*,DWORD);
Expand Down
21 changes: 14 additions & 7 deletions src/Helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@
* *
*******************************************************************************/

#if !defined(WINVER)
#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x501
#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/
#endif
#if !defined(NTDDI_VERSION)
#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/
#endif
#define VC_EXTRALEAN 1

#include <windows.h>
#include <shlobj.h>
#include <shlwapi.h>
Expand Down Expand Up @@ -1364,6 +1371,7 @@ BOOL ExtractFirstArgument(LPCWSTR lpArgs,LPWSTR lpArg1,LPWSTR lpArg2,int len)
BOOL bQuoted = FALSE;

StringCchCopy(lpArg1,len,lpArgs);

if (lpArg2)
*lpArg2 = L'\0';

Expand All @@ -1380,7 +1388,7 @@ BOOL ExtractFirstArgument(LPCWSTR lpArgs,LPWSTR lpArg1,LPWSTR lpArg2,int len)
if (bQuoted)
psz = StrChr(lpArg1,L'\"');
else
psz = StrChr(lpArg1,L' ');;
psz = StrChr(lpArg1,L' ');

if (psz)
{
Expand Down Expand Up @@ -1469,7 +1477,6 @@ void ExpandEnvironmentStringsEx(LPWSTR lpSrc,DWORD dwSrc)
void PathCanonicalizeEx(LPWSTR lpszPath,int len)
{
WCHAR szDst[FILE_ARG_BUF] = { L'\0' };

if (PathCanonicalize(szDst,lpszPath))
StringCchCopy(lpszPath,len,szDst);
}
Expand Down Expand Up @@ -1500,7 +1507,7 @@ DWORD GetLongPathNameEx(LPWSTR lpszPath,DWORD cchBuffer)
DWORD NormalizePathEx(LPWSTR lpszPath,int len)
{
PathCanonicalizeEx(lpszPath,len);
return GetLongPathNameEx(lpszPath,len);
return GetLongPathNameEx(lpszPath,(DWORD)len);
}


Expand Down Expand Up @@ -1693,11 +1700,11 @@ BOOL MRU_AddFile(LPMRULIST pmru,LPCWSTR pszFile,BOOL bRelativePath,BOOL bUnexpan

int i;
for (i = 0; i < pmru->iSize; i++) {
if (StringCchCompareIX(pmru->pszItems[i],pszFile) == 0) {
LocalFree(pmru->pszItems[i]);
if (pmru->pszItems[i] == NULL) {
break;
}
else if (pmru->pszItems[i] == NULL) {
else if (StringCchCompareIX(pmru->pszItems[i],pszFile) == 0) {
LocalFree(pmru->pszItems[i]);
break;
}
else {
Expand Down
Loading

0 comments on commit eb6d1b0

Please sign in to comment.