There's a bug in the DLL shim code on page 479. The current code looks like:
#define DeclareCMShimFunction(returnResult, name, apiDecl, apiCall) \ DeclareShimFunction(returnResult, name, apiDecl, apiCall, gCondMgrLib) #define DeclareHSShimFunction(returnResult, name, apiDecl, apiCall) \ DeclareShimFunction(returnResult, name, apiDecl, apiCall, gHsapiLib) #define DeclareIAShimFunction(returnResult, name, apiDecl, apiCall) \ DeclareShimFunction(returnResult, name, apiDecl, apiCall, gCondMgrLib)It should be:
#define DeclareCMShimFunction(returnResult, name, apiDecl, apiCall) \ DeclareShimFunction(returnResult, name, apiDecl, apiCall, gCondMgrLib) #define DeclareHSShimFunction(returnResult, name, apiDecl, apiCall) \ DeclareShimFunction(returnResult, name, apiDecl, apiCall, gHsapiLib) #define DeclareIAShimFunction(returnResult, name, apiDecl, apiCall) \ DeclareShimFunction(returnResult, name, apiDecl, apiCall, gInstAideLib)
January 10, 2002
The statement in Chapter 1 that no Palm device would have a keyboard wasn't a good forecast. It turns out that Handspring has announced the Treo 180, which comes in two versions: the Treo 180, which includes a small keyboard, and the Treo 180g, which comes with the traditional Grafitti input area.
Chapter 9, page 252 describes FrmGetObjectID. Unfortunately, that's capitalized wrong. It should be FrmGetObjectId. The entry for that function in the index (on page 669) has the same wrong capitalization.
Chapter 14, Example 14-2 is missing the declaration of err:
#include <Windows.h>
#include "CondMgr.h"
#include <stdio.h>
int main(int argc,char **argv)
{
const char *kCreator ="SLES";
int err;
err = CmInstallCreator(kCreator, CONDUIT_APPLICATION);
if (err == 0)
err = CmSetCreatorName(kCreator, "C:\\Sales\\Debug\\Sales.DLL");
if (err == 0)
err = CmSetCreatorDirectory(kCreator, "Sales");
if (err == 0)
err = CmSetCreatorFile(kCreator, "Sales");
if (err == 0)
err = CmSetCreatorPriority(kCreator, 2);
if (err == 0)
printf("Registration succeeded \n");
else
printf("Registration failed %d \n",err);
return err;
}
Chapter 14, Example 14-3 has a couple of problems (missing include file, a missing return, and the creator should be all-caps). Here's the correct version:
#include <Windows.h>
#include <CondMgr.h>
#include <stdio.h>
int main(int argc,char **argv)
{
const char *kCreator ="SLES";
int numConduitsRemoved = CmRemoveConduitByCreatorID(kCreator);
if (numConduitsRemoved >= 0)
printf("Unregistration succeeded for %d conduits \n", numConduitsRemoved);
else
printf("Unregistration failed %d \n", numConduitsRemoved);
return 0;
}
Chapter 14, Example 14-6 misspells two calls, inverts the check of PalmDLLShimInit (and misses a declaration of err):
#include <Windows.h>
#include "CondMgr.h"
#include <stdio.h>
#include "PalmDLLShim.h"
int main(int argc,char **argv)
{
const char *kCreator ="SLES";
int err;
if (!PalmDLLShimInit("C:\\PalmDLLs")){
fprintf(stderr,"Initialization failed \n");
exit(1);
}
err = CmInstallCreator(kCreator, CONDUIT_APPLICATION);
if (err == 0)
err = CmSetCreatorName(kCreator, "C:\\Sales\\Debug\\Sales.DLL");
if (err == 0)
err = CmSetCreatorDirectory(kCreator, "Sales");
if (err == 0)
err = CmSetCreatorFile(kCreator, "Sales");
if (err == 0)
err = CmSetCreatorPriority(kCreator, 2);
PalmDLLShimDeinit();
if (err == 0)
printf("Registration succeeded \n");
else
printf("Registration failed %d \n",err);
return err;
}
Example 14-7 returns true even if the libraries couldn't be loaded. Here's the fix:
if (!gCondMgrLib ||!gHsapiLib ||!gInstAideLib){
if (gCondMgrLib)
FreeLibrary(gCondMgrLib);
gCondMgrLib =NULL;
if (gHsapiLib)
FreeLibrary(gHsapiLib);
gHsapiLib =NULL;
if (gInstAideLib)
FreeLibrary(gInstAideLib);
gInstAideLib =NULL;
return false;
}