IStorage and XP Embedded SP2 question

G

Guest

Hi,
I am pretty new to XP Embedded. My IMAPI application (uses Microsoft IMAPI
for CD writing) ran well in Windows XP Professional and data written to CDs
without problem. However, when I ran it on my newly created windows XP
Embedded (SP2, not Feature Pack 2007) in the same machine but different
partitions, it didn't work. The call
pIStorage->CreateStorage(wVolumeName, STGM_READWRITE|STGM_SHARE_EXCLUSIVE,
0, 0, &pIVolumeStorage)
returns pIVolumeStorage as a null. As a result, I couldn't create a folder
in the CD and I couldn't copy files to the CD. I have tried the following
things but they didn't work.
1) I have included Ole32.dll in "Program Files\System32" in the embedded
image, that is required by CreateStorage() in MSDN. It didn't work.
2) Then I manually registered Ole32.dll in my XP Embedded environment. The
registration succeeded but I still got a null pointer for pIVolumeStorage
when I ran my application. BTW, I could find IStorage in my registry.
3) Then I changed the IMAPI application folder to allow everyone "full
control". Still it didn't work.

I ran out of options, can anybody shed some light on this?
 
K

KM

Chip,

The path "Program Files\System32" got me concerned that you are not actually building the right image. (should be \windows\system32)

Did you include COM support in the XPe image at first place?
The Ole32.dll belongs to "Primitive: Ole32" component. Do you have this component in your XPe image configuration? It is not enough
to just register the dll, there are more reg.entries required. Also, you will definitely need things like OleAut32 and etc.

In fact, if you included "IMAPI - CD Burning" component and resolve its dependencies in your image configuration you wouldn't have
any need to mess with Ole32 or such. Did you include the IMAPI stack?
 
G

Guest

Hi KM,

Thanks a lot for taking a look of my problem. It was my typo to say
ole32.dll in "Program Files\System32" folder. It is actually in
"WINDOWS\System32" folder in my image. In there, I also have oleaut32.dll (
I believe all these dlls are from the "Information Appliance" macro component
that I selected for the configuration). I have confirmed in my
configurations that both primitives are in it by lowering my visibility
setting to 100. I also confirmed IMAPI component is in the configuration. I
confirmed all the files (22 files)included in Files and Resources of IMAPI
component are in the System32 folder of my image. I further confirmed in my
Embedded XP operating system with RegEdit tool that there are about 21
registry entries that are about the same number as in Registry Data of IMAPI
component in the configuration. It appears I got all the files copied to the
XP Embedded and all the registries set (probably done by FBA) in there. What
else did I overlook? Here are the steps I used to build this simple XP
Embedded image.
1) Used TAP to generate a pmq file.
2) Imported pmq file to generate sld file by using Component Designer.
Selected "Selector Protype Component". Added group membership to this macro
component.
3) Used Component Database Mgr to import sld file into the database.
4) Created my configuration by using Target Designer and selected my device
macro component that I imported into Component Database earlier.
5) Added operating system components to the config by selecting a design
template, Information Appliance. Unselected "DirectX" that I did not need.
Check some options that I needed (Start Menu stuff) in "User Interface Core"
component.
6) Added IMAPI component into config. Added Registry Editor component into
config so that I can do some registry debugging in the Embedded operating
system.
7) Ran dependency check and build the image.
8) Tranferred the newly build image to the newly formatted test partition.
9) Transferred my software build that used IMAPI to the test partition.
10) Re-start the computer. Passed through FBA and reboot second time in the
test partition.
11) Ran my application that used IMAPI in the embedded environment. I got
the same error of null pointer returned by IStorage::CreateStorage()
function. But that didn't happen in XP Professional environment.

Thanks again and please let me know what other areas I have missed.

Chip
 
K

KM

Chip,

Detail and informative reply I should say :) That helps.

Well, at the first glance the app should work. However, since it doesn't you would probably want to try one of the following
approaches:

- At the time your app calls to the IStorage::CreateStorage, run Regmon tool (www.sysinternals.com) and see what Class GUID
(under HKCR\ClsID or HKCR\Interfaces) gets accessed. Perhaps it will show "not found" status in the tool log. Then, matching it to
the XP Pro registry you can find the missing component.

- The same with FileMon tool. Although the best piece of info you'd probably get from running your app through Profiler of
DependencyWalker tool (www.dependencywalker.com)

- Try to create an XPProEmulation image (www.xpefiles.com) for the target platform and see if your app works there. Then you
will know whether the issue is there due to a missing component or not.

- Try another IMAPI applications (3rd party) to see if you can repro the issue.
 
K

KM

And, btw, what was the hresult code returned from the failed call to IStorage::CreateStorage?
 
K

KM

And, btw, what was the hresult code returned from the failed call to IStorage::CreateStorage?
 
G

Guest

Dear KM,

You pointed me to the right direction. I just found out the problem a few
minutes ago and fixed it. Here is how my IMAPI application works. The user
selects medical records for archiving to CD. My C++ code will create a
folder in the CD by using a name that combines the computer name and the
current date (by using GetComputerName() and GetCurrentTime() API calls).
Then the medical records (files) will be copied to this folder. However, the
folder name that got into the first parameter of IStorage::CreateStorage()
function had the number of characters over 31 that was the limit of
CreateStorage() function could handle. It was a shame on my part that I
neglected to check this hresult code in my application. My test on the
application in the XP Professional parition didn't detect the problem because
the computer name had been set by the network administrator in the company.
The computer name was only 6 characters. When combining with the date format
that took 16 characters, the total was 22 characters. So it slipped through
the test. But when I tested the application in the embedded enviornment.
The computer name that my code picked up was a 16 character OEM computer
name. It caused my folder name 1 character over the limit. It then caused
null pointer as a result. So my solution was to truncate the computer name
to 13 characters so that the folder name will have the number of characters
well below 31. Of course, now I checked that hresult and handled that error.
So finally I was able to archive medica records into the CD in the embedded
environment.

KM, you are the best! I learned a lot from you.
 
K

KM

Chip,

Glad that helped you to fix the problem.
Not that it was a big help from my side :) but sometimes a fresh look at a problem from another dev can shed some light or open
more directions for investigation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top