Win32OperatingSystem.st
changeset 25139 ee3a1332f546
parent 25138 cabf976a45b9
child 25184 5b1c5f143284
equal deleted inserted replaced
25138:cabf976a45b9 25139:ee3a1332f546
  4142     /*
  4142     /*
  4143      * CreateProcess supports 32767 characters/bytes including all variables and values
  4143      * CreateProcess supports 32767 characters/bytes including all variables and values
  4144      * so take a good average for its arguments 4096
  4144      * so take a good average for its arguments 4096
  4145      * ATTENTION this value is also used hardcoded in the following code to check the length
  4145      * ATTENTION this value is also used hardcoded in the following code to check the length
  4146      */
  4146      */
  4147     wchar_t cmdPathW[4096];
  4147     #define MAX_WPATH 4096
  4148     wchar_t cmdLineW[4096];
  4148     wchar_t cmdPathW[MAX_WPATH];
  4149     wchar_t dirNameW[4096];
  4149     wchar_t cmdLineW[MAX_WPATH];
       
  4150     wchar_t dirNameW[MAX_WPATH];
  4150 
  4151 
  4151     /*
  4152     /*
  4152      * pass pointers to CreateProcess
  4153      * pass pointers to CreateProcess
  4153      * NULL pointers used to indicate no value
  4154      * NULL pointers used to indicate no value
  4154      * so only set the pointer if the value is valid
  4155      * so only set the pointer if the value is valid
  4176          * terminate the multi byte strings
  4177          * terminate the multi byte strings
  4177          */
  4178          */
  4178         // #commandPathUni16
  4179         // #commandPathUni16
  4179         if (commandPathUni16 != nil) {
  4180         if (commandPathUni16 != nil) {
  4180             l = __unicode16StringSize(commandPathUni16);
  4181             l = __unicode16StringSize(commandPathUni16);
  4181             if (l >= 4096) { // >= need 1 space for terminator
  4182             if (l >= MAX_WPATH) { // >= need 1 space for terminator
  4182 # ifdef PROCESSDEBUGWIN32
  4183 # ifdef PROCESSDEBUGWIN32
  4183                 if (flag_PROCESSDEBUGWIN32) {
  4184                 if (flag_PROCESSDEBUGWIN32) {
  4184                     console_fprintf(stderr, "argument #commandPathUni16 is to long\n");
  4185                     console_fprintf(stderr, "argument #commandPathUni16 is to long\n");
  4185                 }
  4186                 }
  4186 # endif
  4187 # endif
  4193             cmdPathWP = &cmdPathW[0];
  4194             cmdPathWP = &cmdPathW[0];
  4194         }
  4195         }
  4195 
  4196 
  4196         // commandLineUni16
  4197         // commandLineUni16
  4197         l = __unicode16StringSize(commandLineUni16);
  4198         l = __unicode16StringSize(commandLineUni16);
  4198         if (l >= 4096) { // >= need 1 space for terminator
  4199         if (l >= MAX_WPATH) { // >= need 1 space for terminator
  4199 # ifdef PROCESSDEBUGWIN32
  4200 # ifdef PROCESSDEBUGWIN32
  4200             if (flag_PROCESSDEBUGWIN32) {
  4201             if (flag_PROCESSDEBUGWIN32) {
  4201                 console_fprintf(stderr, "argument #commandLineUni16 is to long\n");
  4202                 console_fprintf(stderr, "argument #commandLineUni16 is to long\n");
  4202             }
  4203             }
  4203 # endif
  4204 # endif
  4210         cmdLineWP = &cmdLineW[0];
  4211         cmdLineWP = &cmdLineW[0];
  4211 
  4212 
  4212         // #dirNameUni16
  4213         // #dirNameUni16
  4213         if (__isUnicode16String(dirNameUni16)) {
  4214         if (__isUnicode16String(dirNameUni16)) {
  4214             l = __unicode16StringSize(dirNameUni16);
  4215             l = __unicode16StringSize(dirNameUni16);
  4215             if (l >= 4096) { // >= need 1 space for terminator
  4216             if (l >= MAX_WPATH) { // >= need 1 space for terminator
  4216 # ifdef PROCESSDEBUGWIN32
  4217 # ifdef PROCESSDEBUGWIN32
  4217                 if (flag_PROCESSDEBUGWIN32) {
  4218                 if (flag_PROCESSDEBUGWIN32) {
  4218                     console_fprintf(stderr, "argument #dirNameUni16 is to long\n");
  4219                     console_fprintf(stderr, "argument #dirNameUni16 is to long\n");
  4219                 }
  4220                 }
  4220 # endif
  4221 # endif