PDA

View Full Version : MsiGetProperty - ComputerName



NewsArchive
03-24-2000, 01:00 AM
That was exactly what I did wrong. Thanks. I wish InstallShield would work
more like VB and correct these for you. It is very frustrating!!!

"Robert M. Dickau"
<i_wish_i_had_time_to_answer_individual_questions_through_email_but_i_don't@
installshield.com> wrote in message
news:38dbb88c.0@news.installshield.com...
> Could be a capitalization problem: the API is "MsiGetProperty", not
> "MSIGetProperty"; and it will be prototyped for you if you #include
"iswi.h"
> at the top of your script.
>
> John Clayton wrote in message <38db9357.0@news.installshield.com>...
> >I am using the MSIGetProperty in several of my ISScript functions to pull
> in
> [...]
>
>

NewsArchive
02-12-2001, 01:00 AM
Thanks for the suggestion. I tried it - meaning I implemented your
suggestion, cut a new CD, and installed - but it still doesn't work.

I am calling MsiGetProperty after InstallFinalize in the Execute Sequence.
Is it possible that SETUPTYPE and INSTALLLEVEL are gone at this point when
the install is run from the CD? I considered making my own property in the
SetupType dialog, but I'll bet that it is gone by that point, too.
Any suggestions on what kind of work around I could use?
Linda

"Alan Aquilina" <aaquilina@dci.de> wrote in message
news:3a8801d9@12.41.20.38...
> I do not know if this solves the problem but once I had this problem that
> properties are returned null. What I did is set the return value to a
> number prior to calling MSIGetProperty >
>
>
>
> Alan
>
>
>
> "Linda Schneider" <schneidl@eglin.af.mil> wrote in message
> news:3a87e8c3@12.41.20.38...
> > The MsiGetProperty is returning Null ("") when installation is run from
a
> > CD.
> > I use this property in my script and can debug and see that it works
> > properly when run from the IPWI environment or from the setup.exe image.
> > Once I cut a CD, however, a Null is being returned.
> >
> > The properties I have tested are SETUPTYPE and INSTALLLEVEL.
> >
> > Thanks in advance for any help or suggestions.
> >
> > --
> > Linda Schneider
> > Systems Analyst/Programmer
> > OSU Field Office
> > Eglin AFB FL
> > schneidl@eglin.af.mil
> >
> >
>
>

NewsArchive
02-13-2001, 01:00 AM
Be aware that Private properties are only available in their own sequence.
So if you set a property in the UI sequence it won't be available in the
execute sequence. However it seems that you are public properties (at
least I recall that INSTALLLEVEL is public). Have you tried creating a
custom action before the InstallInitialize or in the UI sequence:

Type: 51
Source: INSTALLLEVEL
Target: MYINSTALLLEVEL

Then try to read the value of MYINSTALLLEVEL and see if it works.

Alan


"Linda Schneider" <schneidlin@aol.com> wrote in message
news:3a88bfe7@12.41.20.38...
> Thanks for the suggestion. I tried it - meaning I implemented your
> suggestion, cut a new CD, and installed - but it still doesn't work.
>
> I am calling MsiGetProperty after InstallFinalize in the Execute
Sequence.
> Is it possible that SETUPTYPE and INSTALLLEVEL are gone at this point
when
> the install is run from the CD? I considered making my own property in
the
> SetupType dialog, but I'll bet that it is gone by that point, too.
> Any suggestions on what kind of work around I could use?
> Linda
>
> "Alan Aquilina" <aaquilina@dci.de> wrote in message
> news:3a8801d9@12.41.20.38...
> > I do not know if this solves the problem but once I had this problem
that
> > properties are returned null. What I did is set the return value to a
> > number prior to calling MSIGetProperty >
> >
> >
> >
> > Alan
> >
> >
> >
> > "Linda Schneider" <schneidl@eglin.af.mil> wrote in message
> > news:3a87e8c3@12.41.20.38...
> > > The MsiGetProperty is returning Null ("") when installation is run
from
> a
> > > CD.
> > > I use this property in my script and can debug and see that it works
> > > properly when run from the IPWI environment or from the setup.exe
image.
> > > Once I cut a CD, however, a Null is being returned.
> > >
> > > The properties I have tested are SETUPTYPE and INSTALLLEVEL.
> > >
> > > Thanks in advance for any help or suggestions.
> > >
> > > --
> > > Linda Schneider
> > > Systems Analyst/Programmer
> > > OSU Field Office
> > > Eglin AFB FL
> > > schneidl@eglin.af.mil
> > >
> > >
> >
> >
>
>

NewsArchive
02-15-2001, 01:00 AM
I tried your suggestion but it still didn't work probably because I had to
use MsiGetProperty to retrieve the value of MYINSTALLLEVEL in my script.
After 3 workdays, I finally used MsiGetFeatureState to check for a feature
that is installed only on a certain INSTALLLEVEL and Eureka! it worked.
Thanks for your help. Suggestions from others always helps!!!

Linda

Alan Aquilina <aaquilina@dci.de> wrote in message
news:3a88f606@12.41.20.38...
> Be aware that Private properties are only available in their own sequence.
> So if you set a property in the UI sequence it won't be available in the
> execute sequence. However it seems that you are public properties (at
> least I recall that INSTALLLEVEL is public). Have you tried creating a
> custom action before the InstallInitialize or in the UI sequence:
>
> Type: 51
> Source: INSTALLLEVEL
> Target: MYINSTALLLEVEL
>
> Then try to read the value of MYINSTALLLEVEL and see if it works.
>
> Alan
>
>
> "Linda Schneider" <schneidlin@aol.com> wrote in message
> news:3a88bfe7@12.41.20.38...
> > Thanks for the suggestion. I tried it - meaning I implemented your
> > suggestion, cut a new CD, and installed - but it still doesn't work.
> >
> > I am calling MsiGetProperty after InstallFinalize in the Execute
> Sequence.
> > Is it possible that SETUPTYPE and INSTALLLEVEL are gone at this point
> when
> > the install is run from the CD? I considered making my own property in
> the
> > SetupType dialog, but I'll bet that it is gone by that point, too.
> > Any suggestions on what kind of work around I could use?
> > Linda
> >
> > "Alan Aquilina" <aaquilina@dci.de> wrote in message
> > news:3a8801d9@12.41.20.38...
> > > I do not know if this solves the problem but once I had this problem
> that
> > > properties are returned null. What I did is set the return value to a
> > > number prior to calling MSIGetProperty >
> > >
> > >
> > >
> > > Alan
> > >
> > >
> > >
> > > "Linda Schneider" <schneidl@eglin.af.mil> wrote in message
> > > news:3a87e8c3@12.41.20.38...
> > > > The MsiGetProperty is returning Null ("") when installation is run
> from
> > a
> > > > CD.
> > > > I use this property in my script and can debug and see that it works
> > > > properly when run from the IPWI environment or from the setup.exe
> image.
> > > > Once I cut a CD, however, a Null is being returned.
> > > >
> > > > The properties I have tested are SETUPTYPE and INSTALLLEVEL.
> > > >
> > > > Thanks in advance for any help or suggestions.
> > > >
> > > > --
> > > > Linda Schneider
> > > > Systems Analyst/Programmer
> > > > OSU Field Office
> > > > Eglin AFB FL
> > > > schneidl@eglin.af.mil
> > > >
> > > >
> > >
> > >
> >
> >
>
>

NewsArchive
12-18-2001, 01:00 AM
Hi,

I am using MsiGetProperty(ISMSI_HANDLE, "ComputerName", svComputerName, 256)
function to retrieve the computer name. The install program runs well on NT
and W2000. But when it runs on Windows 98, it chops the computer name into 2
characters. Could any one tell me what did I do wrong and how can I correct
it?

Thanks!!!

fanny

NewsArchive
12-18-2001, 01:00 AM
The last argument should be a number variable containing the buffer size (on
input), and not a hard-coded figure: something like this, perhaps:

nBuffer=256;
MsiGetProperty(ISMSI_HANDLE, "ComputerName", svComputerName, nBuffer);

"fanny" <fxiao@emware.com> wrote in message
news:3c1fb79f$1@news.installshield.com...
> Hi,
>
> I am using MsiGetProperty(ISMSI_HANDLE, "ComputerName", svComputerName,
256)
> function to retrieve the computer name. The install program runs well on
NT
> and W2000. But when it runs on Windows 98, it chops the computer name into
2
> characters. Could any one tell me what did I do wrong and how can I
correct
> it?
>
> Thanks!!!
>
> fanny

--
Robert Dickau
Senior Technical Trainer
InstallShield Software Corp.
www.installshield.com/training

NewsArchive
12-18-2001, 01:00 AM
Sounds suspiciously like you're getting Unicode back, a two character name
in two 16 bit Unicode characters, with a null between them.

"fanny" <fxiao@emware.com> wrote in message
news:3c1fb79f$1@news.installshield.com...
> Hi,
>
> I am using MsiGetProperty(ISMSI_HANDLE, "ComputerName", svComputerName,
256)
> function to retrieve the computer name. The install program runs well on
NT
> and W2000. But when it runs on Windows 98, it chops the computer name into
2
> characters. Could any one tell me what did I do wrong and how can I
correct
> it?
>
> Thanks!!!
>
> fanny
>
>

NewsArchive
12-18-2001, 01:00 AM
Thanks for the help!

This sounds like a logical explaination. I have no idea how can I get
arround it. Do you?

fanny

"Phil Wilson" <phil.wilson@nospam.unisys.com> wrote in message
news:3c1fc69a$1@news.installshield.com...
> Sounds suspiciously like you're getting Unicode back, a two character name
> in two 16 bit Unicode characters, with a null between them.
>
> "fanny" <fxiao@emware.com> wrote in message
> news:3c1fb79f$1@news.installshield.com...
> > Hi,
> >
> > I am using MsiGetProperty(ISMSI_HANDLE, "ComputerName", svComputerName,
> 256)
> > function to retrieve the computer name. The install program runs well on
> NT
> > and W2000. But when it runs on Windows 98, it chops the computer name
into
> 2
> > characters. Could any one tell me what did I do wrong and how can I
> correct
> > it?
> >
> > Thanks!!!
> >
> > fanny
> >
> >
>
>

NewsArchive
12-18-2001, 01:00 AM
It might be logical but could just as easily be wrong..........

If it's the case that it's a two-character computer name and what you're
seeing is literally the Unicode version of the two character name, it will
have the first character and a null, then the 2nd and a null, then a null to
terminate the string - I think that's the way Ansi is represented in
Unicode. If on the other hand, you're getting the computer name truncated to
two characters, I'd say that Dr Robert is right because (wild theory)
address 256 in your process has a value of 2 and so you're seeing 2 bytes
returned. As Robert says, that last parameter is supposed to be the address
of a variable that denotes the length of the buffer, so that needs fixing in
any case.

You should also check the result of MsiGetProperty in case it has an error
value.

Your code looks like InstallScript, and if it is I have no idea what's going
on. If it's code in a C++ custom action Dll, maybe your Unicode/Ansi
settings are wrong somehow.

"fanny" <fxiao@emware.com> wrote in message
news:3c1fe106$1@news.installshield.com...
> Thanks for the help!
>
> This sounds like a logical explaination. I have no idea how can I get
> arround it. Do you?
>
> fanny
>
> "Phil Wilson" <phil.wilson@nospam.unisys.com> wrote in message
> news:3c1fc69a$1@news.installshield.com...
> > Sounds suspiciously like you're getting Unicode back, a two character
name
> > in two 16 bit Unicode characters, with a null between them.
> >
> > "fanny" <fxiao@emware.com> wrote in message
> > news:3c1fb79f$1@news.installshield.com...
> > > Hi,
> > >
> > > I am using MsiGetProperty(ISMSI_HANDLE, "ComputerName",
svComputerName,
> > 256)
> > > function to retrieve the computer name. The install program runs well
on
> > NT
> > > and W2000. But when it runs on Windows 98, it chops the computer name
> into
> > 2
> > > characters. Could any one tell me what did I do wrong and how can I
> > correct
> > > it?
> > >
> > > Thanks!!!
> > >
> > > fanny
> > >
> > >
> >
> >
>
>

Drookue
06-10-2005, 12:34 PM
I am not sure if this will help, but I had a problem where I had 5 MsiGetProperty statements in the same function. Some would work fine, but some would have truncated values. I broke them out into 5 seperate functions with 1 MsiGetProperty call per function and it fixed my problem.

Geekoshield
06-17-2005, 09:09 AM
if (RegDBGetKeyValueEx ("SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName","ComputerName", nvType, sComputerName, nvSize) < 0) then
MessageBox( "Failed to get registry key of :" + @REG_COMPUTER_NAME + "\\ComputerName. This identifies the name of the local machine.", WARNING );