[DONE] [TB 1.878 PB 4.30 x64] NetLocalGroupAdd

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

[DONE] [TB 1.878 PB 4.30 x64] NetLocalGroupAdd

Post by lexvictory »

I get a FAsm error saying
CALL NetLocalGroupAdd
error: undefined symbol 'NetLocalGroupAdd'
pb code:

Code: Select all

ProcedureDLL NetLocalGroupAdd(GroupName.s)
  
  ; Renvoie 1 si groupe créé / 0 si erreur de création
  
  parm_err.l
  If NetLocalGroupAdd_(0,0,buf,@parm_err)=0
    retour=1
  Else
    retour=0
  EndIf
  
  ProcedureReturn retour
EndProcedure
Generated ASM:

Code: Select all

format MS64 COFF

Public PB_NetLocalGroupAdd


Extrn SYS_FastAllocateString4
Extrn SYS_FreeString


section '.text' code readable executable

PB_NetLocalGroupAdd:
MOV    qword [rsp+8],rcx
PUSH   r15
PS62=96
XOR    rax,rax
PUSH   rax
PUSH   rax
PUSH   rax
PUSH   rax
PUSH   rax
SUB    rsp,40
MOV    rdx,[rsp+PS62+0]
LEA    rcx,[rsp+40]
SUB    rsp,16
CALL   SYS_FastAllocateString4
ADD    rsp,16
;
; Renvoie 1 si groupe créé / 0 si erreur de création
;
; buf.LOCALGROUP_INFO_0
LEA    rax,[rsp+48]
;
; parm_err.l
; If NetLocalGroupAdd_(0,0,buf,@parm_err)=0
LEA    rax,[rsp+56]
MOV    rax,rax
PUSH   rax
LEA    rax,[rsp+56]
MOV    rax,rax
PUSH   rax
PUSH   qword 0
PUSH   qword 0
POP    rcx
POP    rdx
POP    r8
POP    r9
ADD    rsp,-32
CALL   NetLocalGroupAdd
ADD    rsp,32
MOV    r15,rax
AND    r15,r15
JNE   _EndIf25
; retour=1
MOV    qword [rsp+64],1
; Else
JMP   _EndIf24
_EndIf25:
; retour=0
MOV    qword [rsp+64],0
; EndIf
_EndIf24:
;
; ProcedureReturn retour
MOV    rax,qword [rsp+64]
JMP   _EndProcedure63
;
; EndProcedure
XOR    rax,rax
_EndProcedure63:
PUSH   rax
MOV    rcx,qword [rsp+48]
SUB    rsp,32
CALL   SYS_FreeString
ADD    rsp,32
POP    rax
ADD    rsp,80
POP    r15
RET
Just noticed that parm_err.l receives a pointer, but changing it to .i doesn't fix the problem. (Obviously)
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

change the function name to something else and it works.
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Post by lexvictory »

Is there any way to fix this?
PB functions with the same name as an API function minus the _ works with 4.30 x86 + Tailbite, and 4.30 x64 (when testing with F5)

excuse the ignorance (and non knowledge of ASM), but doesn't it just need Extrn NetLocalGroupAdd?
I just don't understand why it doesn't work only in x64 TB.
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

i removed that check, so lets see what happens :shock:
lexvictory wrote:I just don't understand why it doesn't work only in x64 TB.
in X86 its _NetLocalGroupAdd@16 and in X64 NetLocalGroupAdd, so thats why it works in X86 and not in X64 :wink:
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Post by lexvictory »

ABBKlaus wrote:i removed that check, so lets see what happens :shock:
now it gets a symbol already defined for a shared function - line 28

Code: Select all

format MS64 COFF

Public Droopy_SearchDirectory


Extrn SYS_FastAllocateString4
Extrn PB_Right
Extrn SYS_StringEqual
Extrn SYS_CopyString
Extrn SYS_AllocateString4
Extrn FindFirstFileA
Extrn PB_PeekS
Extrn Droopy_SearchDirectory
Extrn Droopy_SearchFiles
Extrn FindNextFileA
Extrn FindClose
Extrn SYS_FreeString
Extrn PB_StringBasePosition
Extrn Droopy__S24
Extrn PB_StringBase
Extrn Droopy__S25
Extrn Droopy__S26
Extrn Droopy__S27


section '.text' code readable executable

Droopy_SearchDirectory:
MOV    qword [rsp+8],rcx
MOV    qword [rsp+16],rdx
PUSH   rbp
PUSH   r15
PS86=432
MOV    rdx,46
.ClearLoop:

---snip---
ABBKlaus wrote:in X86 its _NetLocalGroupAdd@16 and in X64 NetLocalGroupAdd, so thats why it works in X86 and not in X64 :wink:
Ah, I see, that explains it! There are more differences in x64 than I realised :lol:


And how does TB determine the prefs file to use? Because I remember reading that it would use a different one for x64 than it did for x86, but when I launch TB Manager from PB x86's tools menu, it still uses x64 prefs (and therefore PB x64 paths)
Does a /PREFS: command line option have to be added?
Or should I install separately and tell the x86 IDE to use a different tools file? (It already runs with the /noext option)
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

the above problem should be fixed now.
lexvictory wrote:And how does TB determine the prefs file to use?
TB reads the registry (needs PB run without the /noext switch), takes the path to PB and runs PBCompiler.exe to see what version is running.
lexvictory wrote:Because I remember reading that it would use a different one for x64 than it did for x86, but when I launch TB Manager from PB x86's tools menu, it still uses x64 prefs (and therefore PB x64 paths)
The prefsfile is stored in AppData, the X64 version uses i.e. "TailBite_430X64.prefs"
lexvictory wrote:Does a /PREFS: command line option have to be added?
Or should I install separately and tell the x86 IDE to use a different tools file? (It already runs with the /noext option)
You can install separate versions of TailBite for each version of PB, you should use a folder thats writeable without admin rights.
Just copy the correct "TailBite.prefs" in the TB folder.
For the correct folders you should edit it by hand.
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Post by lexvictory »

ABBKlaus wrote:You can install separate versions of TailBite for each version of PB, you should use a folder thats writeable without admin rights.
Just copy the correct "TailBite.prefs" in the TB folder.
For the correct folders you should edit it by hand.
Thought that might be the other option, although it slipped my mind before.
And the admin rights is no problem - I'm using XP x64.


Thank you for all the help with x64 - Droopy's lib now compiles! (well apart from unicode mode, but that's a PB compiler problem)

You're a genius I tell you! :D
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
Post Reply