this is the code
Code: Select all
Procedure main()
memo.MEMORY_BASIC_INFORMATION
; *pointer = iob()
; Debug Hex(*pointer)
;fprintf(*pointer +2,"errore!")
hInst.l = Loadlibrary_("msvcrt.dll")
If hInst
*pointer = GetProcAddress_(hInst,"__iob_func"); this returns a pointer
to an array of type FILE
*fpr = GetProcAddress_(hInst,"fprintf")
If *pointer
*deb.l = CallCFunctionFast(*pointer)
If VirtualQuery_(*deb,@memo,SizeOf(memo))
Debug memo\State ; = MEM_COMMIT, we can use this memory
EndIf
ret.l = CallCFunctionFast(*fpr,@*deb + 2,"errore!") ;@*deb+2 should be stderr see below
Debug Hex(*deb)
Debug Hex(*fpr)
EndIf
EndIf
FreeLibrary_(hInst)
EndProcedure
main()
End
Code: Select all
typedef struct _iobuf {
int cnt; /* characters left */
char *ptr; /* next character position */
char *base; /* location of buffer */
int flag; /* mode of file access */
int fd; /* file descriptor */
} FILE;
extern FILE _iob[];
#define stdin (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])
Code: Select all
Structure FILE
cnt.l
ptr.l
base.l
flag.l
fd.l
EndStructure
*stderr.l = @*deb + 2
No, it crashes...any ideas?
PS:i already know there's a method of writing to stderr with windows apis, but that is not definitely what i want.



