Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Platform Builder 5.0 Link Error

39 views
Skip to first unread message

cdew4545

unread,
Dec 4, 2009, 10:07:51 AM12/4/09
to
I'm in the process of testing out the Trusted Environment
implementation for windows ce 5.0 that is layed out in the MSDN
website. The signature checking works fine when I code my own string
comparison function, but not when I try to use _wcsicmp() as the
documentation does. When I try to use that function I get

BUILD: [01:0000000040:ERRORE] oal_startup_x86.lib(oeminit.obj) : error
LNK2019: unresolved external symbol __wcsicmp referenced in function
_OEMCertifyInit
BUILD: [01:0000000041:ERRORE] C:\WINCE500\platform\CEPC\target
\x86\retail\kern.exe : fatal error LNK1120: 1 unresolved externals

Anyone know why I would be getting these? I define include the
"extern int _wcsicmp()" prototype at the beginning of the oeminit.c
file.

I also want to implement the SHA1 hashing of rsaenh.dll using
CryptCreateHash(), CryptAcquireContext(), etc. functions, but I get
more link errors. Assuming this is the same issue as _wcsicmp, anyone
have suggestions?

Helge Kruse

unread,
Dec 4, 2009, 11:02:13 AM12/4/09
to

"cdew4545" <cars...@gmail.com> wrote in message
news:cc1efbdc-7760-44b3...@a32g2000yqm.googlegroups.com...

> Anyone know why I would be getting these? I define include the
> "extern int _wcsicmp()" prototype at the beginning of the oeminit.c
> file.

Did you check, that SYSGEN_STDIO is in your pbxml file?

Helge


cdew4545

unread,
Dec 4, 2009, 12:18:50 PM12/4/09
to
When I perform a Sysgen, the variable SYSGEN_STDIO = 1 shows up in the
build output, but I checked my pbxml file and it wasnt in there. I
then added <Feature Name="Item" FeatureVariable="SYSGEN_STDIO"
Anchored="True" /> in the pbxml file and re-sysgened, but I still get
the same link errors.

On Dec 4, 10:02 am, "Helge Kruse" <Helge.Kruse-nos...@gmx.net> wrote:
> "cdew4545" <carson...@gmail.com> wrote in message

cdew4545

unread,
Dec 4, 2009, 1:30:52 PM12/4/09
to

I should add some more info. I run dumpbin /EXPORTS /SYMBOLS
coredll.dll and _wcsicmp is present in the list. Is there any issue
with calling this function in oeminit.c file? I know this file is
loaded early on and has some restrictions to calling system APIs, but
it doesn't seem like there should be a problem here. Also, it *was*
directly from the example in the documenation, not to say that
documentation is always correct.

Paul G. Tobey [ eMVP ]

unread,
Dec 4, 2009, 4:47:01 PM12/4/09
to
You can't call coredll.dll functions from OEMInit(). That's run really early
in the operating system startup, before the loader is running, if I remember
right. I'm not sure that, generally, your code for the kernel portion of
your BSP is linked with the coredll.dll import library (or should be, for
that matter).

Paul T.

"cdew4545" wrote:

> On Dec 4, 11:18 am, cdew4545 <carson...@gmail.com> wrote:
> > When I perform a Sysgen, the variable SYSGEN_STDIO = 1 shows up in the
> > build output, but I checked my pbxml file and it wasnt in there. I
> > then added <Feature Name="Item" FeatureVariable="SYSGEN_STDIO"
> > Anchored="True" /> in the pbxml file and re-sysgened, but I still get
> > the same link errors.
> >
> > On Dec 4, 10:02 am, "Helge Kruse" <Helge.Kruse-nos...@gmx.net> wrote:
> >
> > > "cdew4545" <carson...@gmail.com> wrote in message
> >

> > >news:cc1efbdc-7760-44b3...@a32g2000yqm.googlegroups.com....


> >
> > > > Anyone know why I would be getting these? I define include the
> > > > "extern int _wcsicmp()" prototype at the beginning of the oeminit.c
> > > > file.
> >
> > > Did you check, that SYSGEN_STDIO is in your pbxml file?
> >
> > > Helge
>
> I should add some more info. I run dumpbin /EXPORTS /SYMBOLS
> coredll.dll and _wcsicmp is present in the list. Is there any issue
> with calling this function in oeminit.c file? I know this file is
> loaded early on and has some restrictions to calling system APIs, but
> it doesn't seem like there should be a problem here. Also, it *was*
> directly from the example in the documenation, not to say that
> documentation is always correct.

> .
>

cdew4545

unread,
Dec 5, 2009, 12:48:13 AM12/5/09
to
On Dec 4, 3:47 pm, Paul G. Tobey [eMVP] <paultobey _at_ earthlink

That is what I suspected. I followed http://msdn.microsoft.com/en-us/library/aa448392.aspx
for better or worse. Follow up question, my real goal is to us
CryptCreateHash, etc functions with say they require "coredll.lib."
One, is there a coredll.lib, two is this the same issue. I'm sorry
for asking questions I could test, but I'm away from my computer with
the build system and hope to resolve this issue as quick as possible.

cdew4545

unread,
Dec 6, 2009, 4:10:46 PM12/6/09
to
On Dec 4, 3:47 pm, Paul G. Tobey [eMVP] <paultobey _at_ earthlink
_dot_ net> wrote:

I am wrong. I am not trying to call _wcsicmp inside OEMInit(). I am
implementing OEMCertifyModuleInit/OEMCertifyModule functions. They
are called everytime a module is loaded that is not present in ROM.
Is the fact that I have these functions defined all in oeminit.c where
the issue is? Can the linker not properly link the functions because
they are inside oal_startup_x86.lib?

Paul G. Tobey [eMVP]

unread,
Dec 6, 2009, 7:09:08 PM12/6/09
to
Those functions are certainly not in that library. The potential problem is
linking with an import library. Just as a test, use LoadLibrary,
GetProcAddress to try to load the crypto32.dll (I think that's the right
target for your cryptography stuff). I'm frankly not sure what you can or
can't do from inside the module certification functions...

Paul T.

"cdew4545" <cars...@gmail.com> wrote in message

news:2820adea-9792-494c...@p19g2000vbq.googlegroups.com...

cdew4545

unread,
Dec 8, 2009, 3:31:41 PM12/8/09
to
On Dec 6, 6:09 pm, "Paul G. Tobey [eMVP]" <paul tobey _AT_ earthlink

_DOT_ net> wrote:
> Those functions are certainly not in that library.  The potential problem is
> linking with an import library.  Just as a test, use LoadLibrary,
> GetProcAddress to try to load the crypto32.dll (I think that's the right
> target for your cryptography stuff).  I'm frankly not sure what you can or
> can't do from inside the module certification functions...
>
> Paul T.
>

I'm a bit confused by your comments. Sticking to the _wcsicmp()
example, why would I have to use LoadLibrary() to call _wcsicmp()?
Isn't including the proper header files and extern defintion enough?

In particular, this is what I am referencing:
http://msdn.microsoft.com/en-us/library/aa448392.aspx
if you do a Ctrl+F for _wcsicmp you will find what I am trying to
accomplish. To me, calling a string comparison function (I've even
tried strcmp()) should be a simple task no matter what function I'm
in.

Bruce Eitman [eMVP]

unread,
Dec 8, 2009, 4:24:30 PM12/8/09
to

Well, no. Simply including a header file and extern definitions is not
enough. You must link with the library that implements the function.

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT Eurotech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

Eurotech Inc.
www.Eurotech.com

"cdew4545" <cars...@gmail.com> wrote in message

news:ea525242-be4d-4714...@k9g2000vbl.googlegroups.com...

cdew4545

unread,
Dec 10, 2009, 12:04:34 PM12/10/09
to
On Dec 8, 3:24 pm, "Bruce Eitman [eMVP]"

<bruce.eitman.nos...@Eurotech.com.nospam> wrote:
> Well, no.  Simply including a header file and extern definitions is not
> enough.  You must link with the library that implements the function.
>
> --
> Bruce Eitman (eMVP)
> Senior Engineer
> Bruce.Eitman AT Eurotech DOT com
> My BLOGhttp://geekswithblogs.net/bruceeitman
>
> Eurotech Inc.www.Eurotech.com
>

Since this is my first experience with Windows CE, I'm trying to
figure out where to link the file. I can't find any hint of a
makefile buried behind the IDE.

Paul G. Tobey [ eMVP ]

unread,
Dec 10, 2009, 1:02:01 PM12/10/09
to
makefile.def (default), which I recall being in \public\common\oak\misc, is
what you're looking for. Basically, though, your SOURCES file for a
particular component defines SOURCELIBS and TARGETLIBS to define with what
you are linked. Look at all of the other components in your device built by
Platform Builder to get an idea of what they set and where and when.

I was not suggesting that you use LoadLibrary for _wcsXXX. My reply should
have shown up as a reply to your post about CryptCreateHash(), etc, which you
could try accessing via LoadLibrary...

Paul T.

"cdew4545" wrote:

> On Dec 8, 3:24 pm, "Bruce Eitman [eMVP]"
> <bruce.eitman.nos...@Eurotech.com.nospam> wrote:
> > Well, no. Simply including a header file and extern definitions is not
> > enough. You must link with the library that implements the function.
> >
> > --
> > Bruce Eitman (eMVP)
> > Senior Engineer
> > Bruce.Eitman AT Eurotech DOT com
> > My BLOGhttp://geekswithblogs.net/bruceeitman
> >
> > Eurotech Inc.www.Eurotech.com
> >
> > "cdew4545" <carson...@gmail.com> wrote in message
> >
> > news:ea525242-be4d-4714...@k9g2000vbl.googlegroups.com...
> > On Dec 6, 6:09 pm, "Paul G. Tobey [eMVP]" <paul tobey _AT_ earthlink
> >
> >
> >
> > _DOT_ net> wrote:
> > > Those functions are certainly not in that library. The potential problem
> > > is
> > > linking with an import library. Just as a test, use LoadLibrary,
> > > GetProcAddress to try to load the crypto32.dll (I think that's the right
> > > target for your cryptography stuff). I'm frankly not sure what you can or
> > > can't do from inside the module certification functions...
> >
> > > Paul T.
> >
> > > "cdew4545" <carson...@gmail.com> wrote in message
> >

> > >news:2820adea-9792-494c...@p19g2000vbq.googlegroups.com....

> .
>

Bruce Eitman [eMVP]

unread,
Dec 10, 2009, 1:07:41 PM12/10/09
to
http://geekswithblogs.net/BruceEitman/archive/2008/08/04/platform-builder--sources-files.aspx

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT Eurotech DOT com

My BLOG http://geekswithblogs.net/bruceeitman

Eurotech Inc.
www.Eurotech.com

"cdew4545" <cars...@gmail.com> wrote in message

news:511cd5c9-7cfa-4c22...@f16g2000yqm.googlegroups.com...

cdew4545

unread,
Jan 5, 2010, 4:57:18 PM1/5/10
to
On Dec 10 2009, 12:07 pm, "Bruce Eitman [eMVP]"
<bruce.eitman.nos...@Eurotech.com.nospam> wrote:
> http://geekswithblogs.net/BruceEitman/archive/2008/08/04/platform-bui...

I've done the following things:

1) I tried adding the following to the sources file for
oal_startup_x86.lib project :

SOURCELIBS= \
$(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\coredll.lib \

outcome: Everything linked properly (no longer getting the cannot
find _wcsicmp external symbol error). I built the image, downloaded
it, but it hangs early on trying to connect to the debugger. If I
take out my use of _wcsicmp but still leave in the SOURCELIBS it boots
properly because I assume it actually links in nothing.

2) I searched coredll.def to find what library _wcsicmp() actually
resides in. It shows coreloc.lib. I then used this in the sources
file:

SOURCELIBS= \
$(_WINCEROOT)\public\common\oak\lib\x86\retail\coreloc.lib \

outcome: Again I come up with linking errors, but this time I get 38
errors. These errors all arise from a function name (presumably the
ones in the coreloc.lib) that is referenced in a completely different
function (not the OEMCertifyInit as it shows from the original _wcsicmp
() link problem).

MY QUESTION:
It appears that I've found the correct place to be medelling with all
your previous answers, but I'm still not closer to a solution. I can
write an alternate string comparison function to suit my needs, but I
cannot create my own cryptographic hash function. CryptCreatHash()
also resides in coredll.lib so I'm assuming I will run into the exact
same problems I'm having with _wcsicmp(). Any new advice?


cdew4545

unread,
Jan 6, 2010, 11:46:47 AM1/6/10
to

Another piece of information I think is noteworthy...I include
externally defined functions that reside in loadauth.lib by simply
declaring them within oeminit.c. I do not do any special linking
myself. Why does it work for CertifyModuleInit but not for _wcsicmp?

cdew4545

unread,
Jan 13, 2010, 9:11:30 PM1/13/10
to
On Dec 4 2009, 3:47 pm, Paul G. Tobey [eMVP] <paultobey _at_ earthlink

I've figured out more of my problem. I'm not calling _wcsicmp() from
OEMInit(). I'm only setting up the function pointers pOEMLoadInit and
pOEMLoadModule. The functions that these point to will eventually
call _wcsicmp(), but by the time they are called, most of the OS is
loaded. I've confirmed via debugging that coredll.dll is a module
that is loaded. This means I should have no problem calling _wcsicmp
(), except I still cannot get it to link properly (I debugged without
_wcsicmp() being compiled into the code). From the MSDN documenation,
_wcsicmp() is in link library coredll.dll. This means all I should
need to do is use and extern declaration for _wcsicmp() and include
"coredll.dll" as a TARGETLIBS variable correct? I'm focused on
implicit linking because I get the same sorts of unresolved link
errors trying to explicit link when I call LoadLibrary/GetProcAddress.

Assuming that is correct for implicit linking, I still don't exactly
know what path to put for coredll.dll. I've done a windows search and
tried many of those paths as well as ones for coredll.lib but still
get LNK2019 unresolved symbol errors.

I've also even tried pulling all the code I added to the oeminit.c
file out into its own static library, but the end result is the
same...unresolved link error for _wcsicmp().

Any new direction you have would be wonderful as I'm banging my head
against the wall here.

0 new messages