|
Definition at line 93 of file tenv.c.
References DumpEnvironment(), NT_SUCCESS, NTSTATUS(), NULL, RtlCreateEnvironment(), SetEnvironment(), Status, and TRUE.
00098 {
00099 int i;
00100 PVOID env;
00101 PVOID nenv;
00102 NTSTATUS Status;
00103 char bigbuf[4100];
00104
00105 for (i=0; i<argc; i++) {
00106 printf( "argv[ %d ] = %s\n", i, argv[ i ] );
00107 }
00108
00109 i = 0;
00110 while (envp[ i ]) {
00111 printf( "envp[ %d ] = %s\n", i, envp[ i ] );
00112 i++;
00113 }
00114
00115 for (i=0 ; i<4099 ; i++)
00116 bigbuf[i] = (i%26) + (((i&1) == 0) ? 'a' : 'A');
00117 bigbuf[4099] = '\0';
00118
00119 env = NtCurrentPeb()->ProcessParameters->Environment;
00120 Status = RtlCreateEnvironment(TRUE, &nenv);
00121 if (! NT_SUCCESS( Status )) {
00122 printf( "Unable to create clone environment - %X\n", Status );
00123 return 1;
00124 }
00125
00126
00127 DumpEnvironment( &env);
00128 SetEnvironment( &env, "aaaa", "12345" );
00129 SetEnvironment( &env, "aaaa", "1234567890" );
00130 SetEnvironment( &env, "aaaa", "1" );
00131 SetEnvironment( &env, "aaaa", "" );
00132 SetEnvironment( &env, "aaaa", NULL );
00133 SetEnvironment( &env, "AAAA", "12345" );
00134 SetEnvironment( &env, "AAAA", "1234567890" );
00135 SetEnvironment( &env, "AAAA", "1" );
00136 SetEnvironment( &env, "AAAA", "" );
00137 SetEnvironment( &env, "AAAA", NULL );
00138 SetEnvironment( &env, "MMMM", "12345" );
00139 SetEnvironment( &env, "MMMM", "1234567890" );
00140 SetEnvironment( &env, "MMMM", "1" );
00141 SetEnvironment( &env, "MMMM", "" );
00142 SetEnvironment( &env, "MMMM", NULL );
00143 SetEnvironment( &env, "ZZZZ", "12345" );
00144 SetEnvironment( &env, "ZZZZ", "1234567890" );
00145 SetEnvironment( &env, "ZZZZ", "1" );
00146 SetEnvironment( &env, "ZZZZ", "" );
00147 SetEnvironment( &env, "ZZZZ", NULL );
00148 SetEnvironment( &env, "BIGBUF", bigbuf );
00149 SetEnvironment( &env, "BIGBUF", NULL );
00150
00151
00152 DumpEnvironment(nenv);
00153 SetEnvironment( &nenv, "aaaa", "12345" );
00154 SetEnvironment( &nenv, "aaaa", "1234567890" );
00155 SetEnvironment( &nenv, "aaaa", "1" );
00156 SetEnvironment( &nenv, "aaaa", "" );
00157 SetEnvironment( &nenv, "aaaa", NULL );
00158 SetEnvironment( &nenv, "AAAA", "12345" );
00159 SetEnvironment( &nenv, "AAAA", "1234567890" );
00160 SetEnvironment( &nenv, "AAAA", "1" );
00161 SetEnvironment( &nenv, "AAAA", "" );
00162 SetEnvironment( &nenv, "AAAA", NULL );
00163 SetEnvironment( &nenv, "MMMM", "12345" );
00164 SetEnvironment( &nenv, "MMMM", "1234567890" );
00165 SetEnvironment( &nenv, "MMMM", "1" );
00166 SetEnvironment( &nenv, "MMMM", "" );
00167 SetEnvironment( &nenv, "MMMM", NULL );
00168 SetEnvironment( &nenv, "ZZZZ", "12345" );
00169 SetEnvironment( &nenv, "ZZZZ", "1234567890" );
00170 SetEnvironment( &nenv, "ZZZZ", "1" );
00171 SetEnvironment( &nenv, "ZZZZ", "" );
00172 SetEnvironment( &nenv, "ZZZZ", NULL );
00173 SetEnvironment( &nenv, "BIGBUF", bigbuf );
00174 SetEnvironment( &nenv, "BIGBUF", NULL );
00175 return( 0 );
00176 }
|