flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
typedef 31 Jan 2014, 22:45
Your question is too generalized. What doesn't work?
Editor? Compiler? API ? This website? You? |
|||
![]() |
|
Force 31 Jan 2014, 22:52
typedef
i m trying to translate that Autodial internet connection code i think after this code Code: invoke lstrcpy,rpp.szEntryName,RASENTRYNAME.szEntryName[EAX] invoke RasGetEntryDialParams,0,rpp, fPass eax value is not zero so it is Failed Last edited by Force on 01 Feb 2014, 00:01; edited 1 time in total |
|||
![]() |
|
typedef 31 Jan 2014, 23:03
Quote:
What is EAX doing here? Is this compiling in FASM? Your're better off translating from C to FASM syntax not from MASM to FASM. |
|||
![]() |
|
Force 31 Jan 2014, 23:12
Code: invoke lstrcpy,rpp.szEntryName,RASENTRYNAME.szEntryName[EAX] invoke RasGetEntryDialParams,0,rpp, fPass cmp eax, 0 ; ====== > this eax jne RetFail mov [hConn], 0 in MSDN DWORD RasGetEntryDialParams( LPTSTR lpszPhonebook, // pointer to the full path and filename of the phone-book file LPRASDIALPARAMS lprasdialparams, // pointer to a structure that receives the connection parameters LPBOOL lpfPassword // indicates whether the user's password was retrieved ); Return Values If the function succeeds, the return value is zero. |
|||
![]() |
|
Force 31 Jan 2014, 23:22
yes C code looks simple
maybe somebody can translate it from C to Fasm who knows C language |
|||
![]() |
|
HaHaAnonymous 31 Jan 2014, 23:54
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 18:21; edited 1 time in total |
|||
![]() |
|
typedef 01 Feb 2014, 01:14
I just tried to rewrite the code from http://blog.csdn.net/fornormandy/article/details/70039 to FASM. It does execute but after a bit of debugging I noticed I was getting error 632 (ERROR_INVALID_SIZE). Hmm, I did a Google search, then bam!. It turns out it's not an easy task. I was going to write the whole code for you but since I know it can be fixed, I'll leave it to you. The first call worked on my computer and it did return my list of VPN names.
So here, (define the structure in the code attached then use GetVersionEx to determine which structure to use) Link 1 (solution): http://www.powerbasic.com/support/pbforums/showthread.php?t=14367 TIP: Use ras.h (Comes with your Windows SDK) to create the structures in FASM like I was doing then use GetVersionEx API to determine which structure to use. Structure definitions: (Please read these thoroughly) RASDIALPARAMS http://msdn.microsoft.com/en-us/library/windows/desktop/aa377238(v=vs.85).aspx RASENTRYNAME http://msdn.microsoft.com/en-us/library/windows/desktop/aa377267(v=vs.85).aspx RAS Error codes http://msdn.microsoft.com/en-us/library/windows/desktop/bb530704(v=vs.85).aspx Windows Versions http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx Rules For Programming On Windows: 1. Read the documentation 2. USE A FUCKING DEBUGGER. Actually on any platform. It's the closest thing to the truth. If I missed anything you'll be able to figure it out. I did you a huge favor here pal. ![]()
|
|||||||||||
![]() |
|
Force 01 Feb 2014, 01:53
Thanks for helping typedef i will read those documentations
and i will try to translate it from C as I know Masm32 code is confusing |
|||
![]() |
|
Force 01 Feb 2014, 12:02
I translated it from C to Fasm. Anyway it works now
Tested on Windows7 with Huawei modem AUTODIAL FASM CODE : Code: format PE GUI 4.0 entry start include 'd:\fasm\include\win32a.inc' struc dd [arg] { common . dd arg sizeof.#. = $-. } struct RASENTRYNAME dwSize dd ? szEntryName db 260 dup(?) dwFlags dd ? szPhonebookPath db 264 dup(?) ends struct RASDIALPARAMS dwSize dd ? szEntryName db 101h dup(?) szPhoneNumber db 81h dup(?) szCallbackNumber db 81h dup(?) szUserName db 101h dup(?) szPassword db 101h dup(?) szDomain db 13h dup(?) dwSubEntry dd ? dwCallbackId dd ? ends section '.data'data writable readable szApp db "AutoDial",0 szSucc db "CONNECTION SUCCESSFUL !",0 szFail db "CONNECTION FAILED",0 dwCb dd ? dwEntries dd 0 fPass dd 0 hConn dd ? ren RASENTRYNAME rpp RASDIALPARAMS section '.code' code readable executable start: mov [dwCb],sizeof.RASENTRYNAME mov eax,[dwCb] mov [ren.dwSize],eax invoke RasEnumEntries,NULL,NULL,ren,dwCb,dwEntries cmp eax,0 jne Fail mov eax,sizeof.RASDIALPARAMS mov [rpp.dwSize],eax invoke lstrcpy,rpp.szEntryName, ren.szEntryName invoke RasGetEntryDialParams,NULL, rpp, fPass invoke RasDial,NULL,NULL,rpp,0,NULL,hConn cmp eax,0 jne Fail invoke MessageBoxTimeout,0,szSucc,szApp,MB_ICONWARNING,LANG_NEUTRAL,5000 jmp Exit Fail: invoke MessageBoxTimeout,0,szFail,szApp,MB_ICONWARNING,LANG_NEUTRAL,5000 Exit: invoke ExitProcess,NULL section '.idata' import data readable writable library kernel32,'KERNEL32.DLL',\ user32 ,'USER32.DLL',\ rasapi32,'RASAPI32.DLL' import user32,\ MessageBoxTimeout,'MessageBoxTimeoutA' import rasapi32,\ RasEnumEntries,'RasEnumEntriesA',\ RasGetEntryDialParams,'RasGetEntryDialParamsA',\ RasDial,'RasDialA' include 'd:\fasm\include\api\kernel32.inc' |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.