Board index » off-topic » Using "fopen" from crtdll.dll - no information (.inc) found ...

Using "fopen" from crtdll.dll - no information (.inc) found ...


2003-10-20 07:35:09 PM
off-topic16
Hello all,
I'm currently trying to browse thru some text, and want to be able to read
single lines outof it. Someone suggested I should use "fopen" and it's
family-members, as available in CRTDLL.DLL.
Alas, for some reason I can't seem to find information (include or even an
C(++) header-file) to it. The Help-file I do have (stating "Microsoft?
Win32?Programmer's Reference") does not even know of the existence of fopen
....
Can anyone point me to where I can find an include-file to the CRTDLL.DLL,
or maybe other ones ("Msvcrt.dll", "Msvcrt??.dll" or "Rpcrt4.dll" maybe)
that may even be more relevant to my cause ?
Regards,
Rudy Wieser
 
 

Re:Using "fopen" from crtdll.dll - no information (.inc) found ...

R.Wieser < XXXX@XXXXX.COM >wrote in message
Quote
I'm currently trying to browse thru some text, and want to be able to
read
single lines outof it. Someone suggested I should use "fopen" and it's
family-members, as available in CRTDLL.DLL.

Alas, for some reason I can't seem to find information (include or even an
C(++) header-file) to it. The Help-file I do have (stating "Microsoft?
Win32?Programmer's Reference") does not even know of the existence of
fopen
fopen? No. It's a C standard function, but not Win32's.
Have a look at the API 'CreateFile' and file funtion group in Win32 SDK
reference.
Those APIs can do what you want.
 

Re:Using "fopen" from crtdll.dll - no information (.inc) found ...

Koms Bomb wrote:
Quote
>I'm currently trying to browse thru some text, and want to be able to
read

fopen? No. It's a C standard function, but not Win32's.
Have a look at the API 'CreateFile' and file funtion group in Win32 SDK
reference.
Those APIs can do what you want.
Except the WinApi doesn't have an fgets() type function, which I think
he is wanting to do.
Those standard C functions are listed in BCB5.hlp, and most if not all
C programming books.
 

{smallsort}

Re:Using "fopen" from crtdll.dll - no information (.inc) found ...

Hi Rudy,
Quote
I'm currently trying to browse thru some text, and want to be able to
read single lines outof it.
You can do it with either reading from the file into a buffer
or using a file-mapping object.
[...]
Quote
Can anyone point me to where I can find an include-file to the ...
Heh! www.ols-lab.com/devcorner/impinc/ ;-)
 

Re:Using "fopen" from crtdll.dll - no information (.inc) found ...

Bob Gonder < XXXX@XXXXX.COM >schreef in berichtnieuws
XXXX@XXXXX.COM ...
Hello Bob, Koms,
Quote
Koms Bomb wrote:
>fopen? No. It's a C standard function, but not Win32's.
I've found "fopen" in 4 DLL's, being CRTDLL.DLL and in 3 versions of
MSVCRT*.DLL. I'm not sure if those are part of a clean windows-install, or
if they where added by one of the programs I installed later ...
Quote
>Have a look at the API 'CreateFile' and file funtion group
>in Win32 SDK reference.
>Those APIs can do what you want.
Not quite, as the 'CreateFile' family only seems to handle binary files (no
text-mode functions). At least, that's when I found when I thought I could
persuade it to work in text-mode :-)
Quote
Except the WinApi doesn't have an fgets() type function,
which I think he is wanting to do.
You betcha ! :-)
Actually, I'm trying to parse an e-mail or newsgroup-message, and thought I
could use the function to read the contents line-by-line ...
Quote
Those standard C functions are listed in BCB5.hlp, and most if not all
C programming books.
Hmmm ... Just downloaded a version of BCB5.HLP, but it did not seem to know
anything about 'fopen' and such :-\
And I'm sure that these functions will (and should) be part of a book
talking about C , but actually I'm programming in Assembly, and try to keep
it at that :-)
Thanks for the help though.
Regards,
Rudy Wieser
 

Re:Using "fopen" from crtdll.dll - no information (.inc) found ...

Vasya Pupkin < XXXX@XXXXX.COM >schreef in berichtnieuws
XXXX@XXXXX.COM ...
Quote
Hi Rudy,
Hello Vasya,
Quote
>I'm currently trying to browse thru some text, and want to be able to
>read single lines outof it.

You can do it with either reading from the file into a buffer
or using a file-mapping object.
Que ? A file-mapping object ? I have absolutily no idea what you're
talking about :-\
I thought about loading blocks of data into a buffer, and read the data
char-by-char from it. Or find some call that does that for me :-)
I found that "fgets" does the job of reading the file line-by-line allright,
but allso terminates on a Ctrl-Z -char. And that is something I currently
do *not* need ... So, I think I have to do the buffering myself :-)
Quote
>Can anyone point me to where I can find an include-file to the ...

Heh! www.ols-lab.com/devcorner/impinc/ ;-)
Thanks for the pointer. I just tried it, and it generates a nice
output-file. Alas, I used TDUMP and QBasic to generate such an
include-file myself, so I do not need really that program :-)
By the way : I tried to convert a WINSOCK.DLL that I copied, from
C:\WINDOWS, into the directory the program was in, but for some reason it
could not find it (not at it's origional place, nor in the current directory
!).... When I tried the program with KERNEL32.DLL (C:\WINDOWS\SYSTEM) it
worked o.k. ... Strange !
The problem is that you can't extract which & what kind of arguments the
contained functions need. And that was/is what I was looking for.
Currently I do have a link to a few pages at MS, but have to convert them to
a single readable document myself. I hoped that such information was
allready compiled & ready for download. Well, you can't have everything,
can you ? :-)
Thanks for the help.
Regards,
Rudy Wieser
 

Re:Using "fopen" from crtdll.dll - no information (.inc) found ...

Hi Rudy,
[...]
Quote
Que ? A file-mapping object ? I have absolutily no idea what you're
talking about :-\
For example:
proc ParseFile
arg @@lpFileName:dword
local @@hFile:dword,@@dwSize:dword,@@hMap:dword,@@lpMap:dword
call CreateFile,[@@lpFileName],GENERIC_READ ... ; blah-blah-blah
mov [@@hFile],eax
call GetFileSize,eax,0
mov [@@dwSize],eax
call CreateFileMapping,[@@hFile],0,PAGE_READONLY,0,0,0
mov [@@hMap],eax
call MapViewOfFile,eax,FILE_MAP_READ,0,0,0
mov [@@lpMap],eax
; ... do something here ...
; [@@lpMap] points to the data
; [@@dwSize] is size of the data
call UnmapViewOfFile,[@@lpMap]
call CloseHandle,[@@hMap]
call CloseHandle,[@@hFile]
ret
endp
[...]
Quote
By the way : I tried to convert a WINSOCK.DLL that I copied, from
C:\WINDOWS, into the directory the program was in, but for some reason
it could not find it (not at it's origional place, nor in the current
directory !)....
WINSOCK.DLL is 16-bit library. You should use WSOCK32.DLL instead.
Quote
The problem is that you can't extract which & what kind of arguments the
contained functions need. And that was/is what I was looking for.
Alas, DLLs do not contain such info :-(
 

Re:Using "fopen" from crtdll.dll - no information (.inc) found ...

Vasya Pupkin < XXXX@XXXXX.COM >schreef in berichtnieuws
XXXX@XXXXX.COM ...
Quote
Hi Rudy,
Hello Vasya,
Quote
[...]
>Que ? A file-mapping object ? I have absolutily no idea what you're
>talking about :-\

For example:
[Snip]
Thanks ! It explains a lot. I think I've read about file-mapping (but than
for smallish windows), but this looks like another good method to easily
access file-contents. I've stored the example, to be looked at closely.
Quote
>By the way : I tried to convert a WINSOCK.DLL that I copied, from
>C:\WINDOWS, into the directory the program was in, but for some reason
>it could not find it (not at it's origional place, nor in the current
>directory !)....

WINSOCK.DLL is 16-bit library. You should use WSOCK32.DLL instead.
Duh ! You're quite right ofcourse. Did not think about/realize that the
the program would differ between 16 & 32-bit code.
Alas, here too you can see that error-messages do not allway's tell the
truth (and can easily put you on the "wrong" foot )... The file was there,
just not convertable by the program ....
Quote
>The problem is that you can't extract which & what kind of arguments the
>contained functions need. And that was/is what I was looking for.

Alas, DLLs do not contain such info :-(
Not quite true ! :-) The first three entries of CRTDLL.DLL (the ones
that start, using TDump, with question-marks) have encoded information
embedded in them that specifies the type & size of the result, and of all
the arguments to the function.
But that does not mean I've got any idea to what they do :-)
I once hoped that that kind of information was present for every one of the
functions, but just was not able to retrieve ... Only later on (after I
inspected a DLL-file on the binary level and found nothing) I realized that
what I had read about it was just some special-case ... :-(
Regards,
Rudy Wieser