News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Question on preference using MSVCRT functions

Started by hutch--, February 15, 2005, 02:58:07 AM

Previous topic - Next topic

hutch--

The first attempt at making the msvcrt functionality available ran into the problem of naming conflists with both assembler instructions and procedures in the MASM32 library. I don't see it as reasonable to take the entire naming range of the msvcrt functions as it is still a DLL call in this context so there is another alternative, there is another method of prototyping imported prcedues from a DLL in MASM using EXTERNDEF that will not have the direct name conflicts so I wondered if building the library using the technique that Vortex wrote and prepending something like "crt_" to the msvcrt function names would be a viable way to make the capacity available.

It would mean that prototypes for functions,


; fabs PROTO C :VARARG
; abs PROTO C :VARARG
; div PROTO C :VARARG


Could produce the names,


  crt_fabs
  crt_abs
  crt_div


Which removes the naming conflicts.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GregL

It sounds like a good idea to me Hutch. I have used the MSVCRT functions in MASM32 and they work great, but I wasn't able to include both the MSVCRT lib and the MASM32 lib due to the conflicts. I ended up using only the MSVCRT functions in that program. I decided it was too much trouble to combine the two libs. It would be great if they didn't conflict.

jj2007

Found this at http://msdn2.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx

What is the difference between msvcrt.dll and msvcr80.dll?

The msvcrt.dll is now a "known DLL," meaning that it is a system component owned and built by Windows. It is intended for future use only by system-level components.


Then, a definition of "known dlls" at http://msdn2.microsoft.com/en-us/library/ms811694.aspx

You cannot redirect the 20 KnownDLLs, which are listed in HKEY_LOCAL_MACHINE\ SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs. Most of them cannot run side by side because they need to maintain cross-process state. For example, kernel32, user32, and ole32 cannot be redirected because they have state (kernel objects, window handles, and running object table for local server) that needs to exist across processes. In a future OS release, several of these DLLs will be implemented so they can run side by side and the KnownDLLs list will shrink.

Out of curiosity, I checked my (XP Home SP1) registry and found to my surprise ... no msvct.dll in the "known" list.
Question: How safe is it to use msvcrt functions?
Apologies for reopening an old thread...

hutch--

jj,

Try a test EXE with MSVCRT calls in it and if it runs its safe. I seriously doubt that they would break such a common DLL, I would imagine they will just go for more side by side versions. The original MSVCRT is probably emulated from later DLL as richedit can do richedt 1,2,3 and later.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Well, I did that test already and of course it runs on my box. I just wondered whether it will still run on Vista if it disappeared already on XP's "KnownDlls" list. But you are perfectly right that it is a very common DLL... if they don't break 16-bit apps, then using msvcrt should be on the safe side, I guess. Thanx anyway for your reassuring words  :U

GregL

QuoteI just wondered whether it will still run on Vista ...

msvcrt.dll is still there in Vista. I don't see how they could get rid of it.

Here's the VersionInfo for it from Vista Home Premium.

    File:             C:\Windows\System32\msvcrt.dll
    InternalName:     msvcrt.dll
    OriginalFilename: msvcrt.dll
    FileVersion:      7.0.6001.18000 (longhorn_rtm.080118-1840)
    FileDescription:  Windows NT CRT DLL
    Product:          Microsoft® Windows® Operating System
    ProductVersion:   7.0.6001.18000
    Debug:            False
    Patched:          False
    PreRelease:       False
    PrivateBuild:     False
    SpecialBuild:     False
    Language:         English (United States)




Vortex

jj2007,

Sorry me for my curiosity but why don't you install XP service pack 2 ?

jj2007

Quote from: Vortex on March 26, 2008, 07:01:53 PM
jj2007,

Sorry me for my curiosity but why don't you install XP service pack 2 ?

I spent a couple of hours trying to do so, but Windoze gave me cryptic messages saying it was not able to do the install. So I eventually gave up. It's my wife's notebook, French version. Maybe SP3 is worth a new try. Besides, I don't see compelling reasons to do so. In 22 years of computing I only got 2 or 3 viruses. If, however, somebody assures me that SP2 or SP3 contain a version of RichEdit that knows how to save the hyperlink format, or how to unhide hidden characters, then I might change my mind. Remember: RichEdit is that 0.03% of the Operating System that allows the user to use formatted text  :wink

Vortex

Did you try to slipstream service pack 2 to your installation disc? You could try the installation in another computer or a virtual machine.