Hello boyz and girlz,

i'm doing some cgi-stuff lately in asm and have some problems with parameter passing.

The cgi's run under IIS Server. The method i use is to get the commandline and read what's standing after <cginame>.exe.
This works only for alphanumeric characters(A-Z or a-z) but not for numbers!

when i call http://localhost/cgi-bin/cgi.exe?5

the cgi doesn't seem to get the number 5.

There must be some other way, like the examples from stryker, but he's using another method and also another assembler than MASM. Actually it is FASM i believe.

Using GetCL from MASMLIB probably works but i don't understand why the parameters must be enclosed within quotation marks?!:confused:

So if anyone knows the right approach for this,.....

Thanks in advance,

Eisodur
Posted on 2002-11-11 06:26:38 by eisodur
Using GetCL from MASMLIB probably works but i don't understand why the parameters must be enclosed within quotation marks?!
First off, I do not know anything about CGI programming.
However, I reacted on what you sayd about 'GetCL'. And I'll try to help you a bit. :)

The parameters doesn't have to be enclosed in quotation marks( " ).
'GetCL' will get any type of param. wich get's passed by the commandline.
You, can use quotation marks, if you need spaces in a param.
Ex.
Input: cgiprog.exe "this is my param"
GetCL Returns: 1 argument (because we used the quoatation marks)
Value of Argument #1: this is my param

Input: cgiprog.exe this is my param
GetCL Returns: 4 arguments (the space seperates each argument)
Value of Argument #1: this
Value of Argument #2: is
Value of Argument #3: my
Value of Argument #4: param
Posted on 2002-11-11 07:02:55 by natas
Arguments to CGI programs are not passed as standard command-line, but rather as an environment variable QUERY_STRING.
Posted on 2002-11-11 07:18:54 by comrade

Arguments to CGI programs are not passed as standard command-line, but rather as an environment variable QUERY_STRING.
That just goes to show how much knowledge I have about the CGI-PL :alright:
Posted on 2002-11-11 07:23:25 by natas
First of all Thanx for your help.

Comrade,

Now i know it's in a environment variable, but i didn't here of this before. Is there some api call to get these variables??
Or is it on the stack perhaps??Or is this GetEnvironmentStrings api call?
Posted on 2002-11-11 08:57:43 by eisodur
.
Posted on 2002-11-11 16:13:59 by comrade
Just out of idle curiosity, how would you do an HTTP upload? Certainly you cannot just stuff any old file into an environment variable. ;)
Posted on 2002-11-11 18:07:51 by iblis
Post-header data would be sent into stdin.
Posted on 2002-11-12 18:07:35 by comrade
Thanks for your help Comrade!!
:)

Nazdravje!!,

Eisodur
Posted on 2002-11-14 04:19:26 by eisodur
this works brother

data
varname db "QUERY_STRING",0
varbuffer db 129 dup (0)

code

    invoke GetEnvironmentVariable,ADDR varname,ADDR varbuffer,128
Posted on 2005-09-12 09:00:12 by Confusius
use sizeof rather than magic numbers. And stay away from masm32lib, I believe the CL functions have buffer overflow problems - issues discussed here:
http://www.old.masmforum.com/viewtopic.php?t=3549 and
http://www.masmforum.com/simple/index.php?topic=1534.0
Posted on 2005-09-12 09:25:52 by f0dder
Have a look at Japheth's ISAPI example too.  For IIS, you will have many advantages.

Regards,  P1  8)
Posted on 2005-09-12 16:40:18 by Pone