It can be done, its much faster, smaller, and actually... easy...
Writing MS Windows Programs in ASM
; ; Super Simple example of CGI coding in win32 assembly language. ; (c)1999 by Jeremy Collake ; http://webpages.charter.net ; collake@charter.net ; --------------------------------------------------------------- ; ; This little program demonstrates CGI implementation in win32asm. ; It simply dumps the value of all filled CGI environment variables ; to the requesting agent. ; ; extrn ExitProcess:PROC extrn WriteConsoleA:PROC extrn GetStdHandle:PROC extrn WriteFile:PROC extrn ExpandEnvironmentStringsA:PROC extrn lstrcmp:PROC extrn lstrlen:PROC extrn GlobalAlloc:PROC extrn GlobalFree:PROC .486p locals jumps .model flat,STDCALL .data cr equ 0dh lf equ 0ah hstdo dd 0 hMem dd 0 byteswrote dd 0 htmlstart db 'Content-Type: text/html', cr,lf,cr,lf html_pre db '<HTML><BODY bgcolor="black"><FONT color="blue">Jeremy''s CGI Environment Variable Dumper<BR></FONT><FONT color="white">',0 Separator db ' = ',0 Post db '<BR>',0 htmlends db '</FONT></BODY></HTML>',0 EnvVariablePointers: dd offset e1 dd offset e2 dd offset e3 dd offset e4 dd offset e5 dd offset e6 dd offset e7 dd offset e8 dd offset e9 dd offset ea dd offset eb dd offset ec dd offset ed dd offset ee dd offset ef dd offset e10 dd offset e11 dd offset e12 dd offset e13 dd 0 EnvVariables: e1 db '%SERVER_SOFTWARE%',0 e2 db '%SERVER_NAME%',0 e3 db '%GATEWAY_INTERFACE%',0 e4 db '%SERVER_PROTOCOL%',0 e5 db '%SERVER_PORT%',0 e6 db '%REQUEST_METHOD%',0 e7 db '%PATH_INFO%',0 e8 db '%PATH_TRANSLATED%',0 e9 db '%SCRIPT_NAME%',0 ea db '%QUERY_STRING%',0 eb db '%REMOTE_HOST%',0 ec db '%REMOTE_ADDR%',0 ed db '%AUTH_TYPE%',0 ee db '%REMOTE_USER%',0 ef db '%REMOTE_IDENT%',0 e10 db '%CONTENT_TYPE%',0 e11 db '%CONTENT_LENGTH%',0 e12 db '%HTTP_ACCEPT%',0 e13 db '%HTTP_USER_AGENT%',0 .code start: call GetStdHandle,-11 mov hstdo,eax call WriteString,offset htmlstart lea esi,EnvVariablePointers jmp mEnvLoop EnvLoop: call GlobalFree,hMem mEnvLoop: lodsd or eax,eax jz EnvLoopEnds mov edi,eax call GlobalAlloc,64,101h mov hMem,eax call ExpandEnvironmentStringsA, edi, eax, 100h call lstrcmp,hMem,dword ptr [esi-4] jz EnvLoop call WriteString,dword ptr [esi-4] call WriteString,offset Separator call WriteString,hMem call WriteString,offset Post jmp EnvLoop EnvLoopEnds: call WriteString,offset htmlends call ExitProcess,0 GetSHandle proc ret GetSHandle endp WriteString proc pString:DWORD call lstrlen,pString call WriteFile,hstdo,pString,eax,offset byteswrote,0 ret WriteString endp end start ends
OR
Comments:
file: /Techref/inet/win32asmcgi/index.htm, 4KB, , updated: 2002/11/1 16:56, local time: 2024/11/14 21:58,
18.227.111.30:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/Techref/inet/win32asmcgi/index.htm"> CGI programming in Win32Asm</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.