From: Vincent Fatica on
On 8 Sep 2009 19:44:44 -0400, Vincent Fatica <vince(a)blackholespam.net> wrote:

|On Tue, 8 Sep 2009 13:32:29 +0800, "xiaosi" <xiaosi(a)cn99.com> wrote:
|
||in ntdll.dll.
||
|| 1180 49B 0000E5C6 _CIcos = __CIcos
|| 1181 49C 0000E682 _CIlog = __CIlog
|
|I tried linking an old, big project with ntdll.dll. That project also uses
|libcmt.dll (/MT) and it uses many functions which are available in both places.
|Even so, I get only one error:
|
|>LIBCMT.lib(_wctype.obj) : error LNK2005: _iswdigit already defined in ntdll.lib(ntdll.dll)
|
|Is there a way to fix that? In general, is there a way to take what's available
|in ntdll.dll from ntdll.dll and anything not available there fromm libcmt.lib?

In fact, that project gets all of these (below) from ntdll.lib (when I imagine
they're also in libcmt.lib). Why is it choking on _iswdigit?

ntdll.dll
1000C278 Import Address Table
100121C0 Import Name Table
0 time date stamp
0 Index of first forwarder reference

4F2 memcpy
4F6 qsort
4D2 _wtol
4D0 _wtoi
522 wcstoul
51D wcsrchr
4F4 memset
514 wcschr
352 RtlUnwind
4D1 _wtoi64
4AE _aullrem
4AC _aulldiv
50E towlower
520 wcstol
4CE _wcsnicmp
51C wcspbrk
--
- Vince
From: xiaosi on
When add /FORCE:MULTIPLE to linker option:
LIBCMT.lib(_wctype.obj) : warning LNK4006: _iswlower already defined in ntdll.lib(ntdll.dll); second definition ignored
LIBCMT.lib(_wctype.obj) : warning LNK4006: _iswdigit already defined in ntdll.lib(ntdll.dll); second definition ignored

"Vincent Fatica" <vince(a)blackholespam.net> wrote:
> On 8 Sep 2009 19:44:44 -0400, Vincent Fatica <vince(a)blackholespam.net> wrote:
>
> |On Tue, 8 Sep 2009 13:32:29 +0800, "xiaosi" <xiaosi(a)cn99.com> wrote:
> |
> ||in ntdll.dll.
> ||
> || 1180 49B 0000E5C6 _CIcos = __CIcos
> || 1181 49C 0000E682 _CIlog = __CIlog
> |
> |I tried linking an old, big project with ntdll.dll. That project also uses
> |libcmt.dll (/MT) and it uses many functions which are available in both places.
> |Even so, I get only one error:
> |
> |>LIBCMT.lib(_wctype.obj) : error LNK2005: _iswdigit already defined in ntdll.lib(ntdll.dll)
> |
> |Is there a way to fix that? In general, is there a way to take what's available
> |in ntdll.dll from ntdll.dll and anything not available there fromm libcmt.lib?
>
> In fact, that project gets all of these (below) from ntdll.lib (when I imagine
> they're also in libcmt.lib). Why is it choking on _iswdigit?
>
> ntdll.dll
> 1000C278 Import Address Table
> 100121C0 Import Name Table
> 0 time date stamp
> 0 Index of first forwarder reference
>
> 4F2 memcpy
> 4F6 qsort
> 4D2 _wtol
> 4D0 _wtoi
> 522 wcstoul
> 51D wcsrchr
> 4F4 memset
> 514 wcschr
> 352 RtlUnwind
> 4D1 _wtoi64
> 4AE _aullrem
> 4AC _aulldiv
> 50E towlower
> 520 wcstol
> 4CE _wcsnicmp
> 51C wcspbrk
> --
> - Vince
From: Alex Blekhman on
"xiaosi" wrote:
> When I open the GetOpenFileName Dialog Box[2], the process adds
> three threads (one ntdll.dll!RtlpTimerThread + two
> ntdll.dll!RtlpWorkerThread). When I close the GetOpenFileName
> Dialog Box, the nocrt.exe!main thread exits, but the other three
> threads remain. After several minutes, the two
> ntdll.dll!RtlpWorkerThread exit but the
> ntdll.dll!RtlpTimerThread remains. The process is not
> terminated!

I see. I always thought that it is the operating system that
closes all threads in the process when main thread exits. It
appears that this logic is implemented by CRT.

Thanks
Alex


From: Alex Blekhman on
"Vincent Fatica" wrote:
> |You can use the ZeroMemory macro, which results in a call to
> ntdll.dll's RtlZeroMemory routine instead of pulling in the CRT.
>
> Tried that ... results in a call to _memset.

I found in the WinNT.h header the SecureZeroMemory macro, which
expands to the RtlSecureZeroMemory function. It is implemented
inline in the header file, so it doesn't have any external
dependencies. Basically, it's a straightforward implementation of
memset.

HTH
Alex


From: Giovanni Dicanio on
Ben Voigt [C++ MVP] ha scritto:

>> In WinNT.h I read:
>>
>> #define RtlZeroMemory(Destination,Length)
>> memset((Destination),0,(Length))
>
> Yes, but I think there is a real exported function in ntdll.dll

Ben: you are right.

But I wonder why they #define'd RtlZeroMemory as an alias to memset in
WinNT.h ...

Giovanni