Unverified Commit d40f4e15 authored by Marcel Raad's avatar Marcel Raad
Browse files

tool: fix Windows Unicode build

... by explicitly calling the ANSI versions of Windows API functions where
required.
parent 2d4413fe
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -39,14 +39,14 @@ static char *GetEnv(const char *variable, char do_expand)
  /* Don't use getenv(); it doesn't find variable added after program was
  /* Don't use getenv(); it doesn't find variable added after program was
   * started. Don't accept truncated results (i.e. rc >= sizeof(buf1)).  */
   * started. Don't accept truncated results (i.e. rc >= sizeof(buf1)).  */


  rc = GetEnvironmentVariable(variable, buf1, sizeof(buf1));
  rc = GetEnvironmentVariableA(variable, buf1, sizeof(buf1));
  if(rc > 0 && rc < sizeof(buf1)) {
  if(rc > 0 && rc < sizeof(buf1)) {
    env = buf1;
    env = buf1;
    variable = buf1;
    variable = buf1;
  }
  }
  if(do_expand && strchr(variable, '%')) {
  if(do_expand && strchr(variable, '%')) {
    /* buf2 == variable if not expanded */
    /* buf2 == variable if not expanded */
    rc = ExpandEnvironmentStrings(variable, buf2, sizeof(buf2));
    rc = ExpandEnvironmentStringsA(variable, buf2, sizeof(buf2));
    if(rc > 0 && rc < sizeof(buf2) &&
    if(rc > 0 && rc < sizeof(buf2) &&
       !strchr(buf2, '%'))    /* no vars still unexpanded */
       !strchr(buf2, '%'))    /* no vars still unexpanded */
      env = buf2;
      env = buf2;
+1 −1
Original line number Original line Diff line number Diff line
@@ -79,7 +79,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
           * already declared via inclusions done in setup header file.
           * already declared via inclusions done in setup header file.
           * We assume that we are using the ASCII version here.
           * We assume that we are using the ASCII version here.
           */
           */
          int n = GetModuleFileName(0, filebuffer, sizeof(filebuffer));
          int n = GetModuleFileNameA(0, filebuffer, sizeof(filebuffer));
          if(n > 0 && n < (int)sizeof(filebuffer)) {
          if(n > 0 && n < (int)sizeof(filebuffer)) {
            /* We got a valid filename - get the directory part */
            /* We got a valid filename - get the directory part */
            char *lastdirchar = strrchr(filebuffer, '\\');
            char *lastdirchar = strrchr(filebuffer, '\\');