Skip to content

Commit

Permalink
Fix size issue
Browse files Browse the repository at this point in the history
  • Loading branch information
RadAd committed Nov 25, 2021
1 parent bd09dc1 commit 17c31bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CmdStartup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ UninstallDisplayIcon={app}\{#MyAppName}Setup.exe
[Code]
#ifdef UNICODE
#define AW "W"
#define CharSize 2
#define AWSizeOffset 1
#else
#define AW "A"
#define CharSize 1
#define AWSizeOffset 2
#endif
function ExpandEnvironmentStrings(lpSrc: String; lpDst: String; nSize: DWORD): DWORD;
Expand All @@ -51,7 +51,7 @@ begin
SetLength(Buf, BufSize); // The internal representation is probably +1 (0-termination)
if ExpandEnvironmentStrings(Input, Buf, BufSize) = 0 then
RaiseException(Format('Expanding env. strings failed. %s', [SysErrorMessage(DLLGetLastError)]));
Result := Copy(Buf, 1, BufSize - {#CharSize});
Result := Copy(Buf, 1, BufSize - {#AWSizeOffset});
end
else
RaiseException(Format('Expanding env. strings failed. %s', [SysErrorMessage(DLLGetLastError)]));
Expand Down

0 comments on commit 17c31bb

Please sign in to comment.