currently, i want to use https communication with web server in masm, are there some example for masm?
Try Iczelion old examples here:
https://win32assembly.programminghorizon.com/source2.html
or, you can also try with Sparcz
http://www.ronybc.com/sparcz.php
hi, guga,
thanks your reply, currently i already implement http send and recv under read following website tutorial:
http://www.madwizard.org/programming/tutorials/netasm/
my problem is , i want to use it on https website, and the protocol is SSL,port is 443.
i download ms sdk v7.0, there was an example named webclient can be reference;
i plan change it from c to masm , but stuck at pointer of struct node:
the webclient.c source code is :
/*****************************************************************************/
static
SECURITY_STATUS
PerformClientHandshake(
SOCKET Socket, // in
PCredHandle phCreds, // in
LPSTR pszServerName, // in
CtxtHandle * phContext, // out
SecBuffer * pExtraData) // out
{
SecBufferDesc OutBuffer;
SecBuffer OutBuffers[1];
DWORD dwSSPIFlags;
DWORD dwSSPIOutFlags;
TimeStamp tsExpiry;
SECURITY_STATUS scRet;
DWORD cbData;
dwSSPIFlags = ISC_REQ_SEQUENCE_DETECT |
ISC_REQ_REPLAY_DETECT |
ISC_REQ_CONFIDENTIALITY |
ISC_RET_EXTENDED_ERROR |
ISC_REQ_ALLOCATE_MEMORY |
ISC_REQ_STREAM;
//
// Initiate a ClientHello message and generate a token.
//
OutBuffers[0].pvBuffer = NULL;
OutBuffers[0].BufferType = SECBUFFER_TOKEN;
OutBuffers[0].cbBuffer = 0;
OutBuffer.cBuffers = 1;
OutBuffer.pBuffers = OutBuffers;
OutBuffer.ulVersion = SECBUFFER_VERSION;
scRet = g_pSSPI->InitializeSecurityContextA(
phCreds,
NULL,
pszServerName,
dwSSPIFlags,
0,
SECURITY_NATIVE_DREP,
NULL,
0,
phContext,
&OutBuffer,
&dwSSPIOutFlags,
&tsExpiry);
...................
my translate source code is :
SecBuffer STRUCT
cbBuffer dword 2 dup(0) ; // always SCHANNEL_CRED_VERSION
BufferType dword 2 dup(0) ;
pvBuffer dword 0
SecBuffer ENDS
SecBufferDesc STRUCT
ulVersion DWORD 0 ; // always SCHANNEL_CRED_VERSION
cBuffers DWORD 0 ;
pBuffers dword 0;SecBuffer <>
SecBufferDesc ENDS
PerformClientHandshake proc Socket:dword,phCreds:dword,pszServerName:dword,phContext:dword,pExtraData:dword
local dwSSPIFlags:dword
local OutBuffer:SecBufferDesc
local OutBuffers[1]:SecBuffer
local dwSSPIOutFlags:dword
local tsExpiry[20]:byte
push ebx
push eax
mov dwSSPIFlags , 08h or 04h or 10h or 4000h or 100h or 8000h
mov OutBuffers[0].pvBuffer , NULL;
mov OutBuffers[0].BufferType , 2;
mov OutBuffers[0].cbBuffer, 0;
mov OutBuffer.cBuffers , 1;
;try method 1
;mov eax, dword ptr OutBuffers
;mov OutBuffer.pBuffers , eax;
;try method 2
xor ebx, ebx
les bx, OutBuffers
mov OutBuffer.pBuffers , ebx;
mov OutBuffer.ulVersion , 0;
;ret
invoke InitializeSecurityContextA, phCreds, NULL, pszServerName, dwSSPIFlags, 0, 10h, NULL, 0, addr phContext, addr OutBuffer,addr dwSSPIOutFlags,addr tsExpiry
PrintHex eax
pop eax
pop ebx
ret
PerformClientHandshake endp
i use mov or les two tyeps translate pointer of struct, but after run this, it always crash;
SecBuffer struct
cbBuffer DWORD ?
BufferType DWORD ?
pvBuffer DWORD ?
SecBuffer ends
PSecBuffer typedef ptr SecBuffer
SecBufferDesc struct
ulVersion DWORD ?
cBuffers DWORD ?
pBuffers PSecBuffer 1t dup (?)
SecBufferDesc ends
Quote from: newrobert on April 22, 2017, 05:00:35 PM
i download ms sdk v7.0, there was an example named webclient
I think that example is in the SDK for Windows 2003, but have not it here now to confirm.
Quote from: mabdelouahab on April 22, 2017, 05:24:27 PM
SecBuffer struct
cbBuffer DWORD ?
BufferType DWORD ?
pvBuffer DWORD ?
SecBuffer ends
PSecBuffer typedef ptr SecBuffer
SecBufferDesc struct
ulVersion DWORD ?
cBuffers DWORD ?
pBuffers PSecBuffer 1t dup (?)
SecBufferDesc ends
thanks, these function already ok, i will continue to next rest part;