This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: GetComputerName returns only the first character of the hostname in IS 2011
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 05, 2010
11:31 PM
GetComputerName returns only the first character of the hostname in IS 2011
My existing project uses the GetComputerName function. After upgrading to IS 2011, only the first character of the hostname is returned.
I also tried the following code on a new project on both IS 2010 and 2011.
IS 2010 returns the full hostname.
IS 2011 returns the first character for the hostname.
I also tried the following code on a new project on both IS 2010 and 2011.
prototype BOOL KERNEL32.GetComputerName(BYREF STRING, BYREF NUMBER);
function OnBegin()
STRING szCmpName;
NUMBER nLength;
begin
//Using Win32 API
nLength = MAX_PATH;
GetComputerName(szCmpName, nLength);
MessageBox(szCmpName, INFORMATION);
end;
IS 2010 returns the full hostname.
IS 2011 returns the first character for the hostname.
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 07, 2010
12:57 PM
The prototype for this API is not specifying which thunk should be used (ANSI or Unicode). Therefore, the engine is defaulting to the Unicode version due to the Unicode changes made for IS 2011. Because the prototype is also using STRING parameters (i.e. ANSI strings), there is an mismatch here between the API and the parameter types. The prototype should be changed to specify which thunk to call (GetComputerNameA for ANSI or GetComputerNameW for Unicode) and the string parameter types should match (STRING for ANSI string parameters, WSTRING for Unicode string parameters).
Please see the "Q208911: Upgrading Projects to InstallShield 2011" article for more information.
Please see the "Q208911: Upgrading Projects to InstallShield 2011" article for more information.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 08, 2010
02:08 AM
Thanks for the information. I will make the nescessary changes as suggested.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 12, 2011
10:33 AM
Thanks, this was a mystery to me also!!!
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)