Problems encountered during setup using inno and Solutions

Source: Internet
Author: User
1. Get the full name of the current Windows user (if the domain user contains the domain name, if the local user contains the computer name), the inno implementation code:

Declare the enumeration type EXTENDED_NAME_FORMAT = (NameUnknown, NameFullyQualifiedDN, NameSamCompatible, NameDisplay );

Declare the API method function GetUserNameEx (NameFormat: EXTENDED_NAME_FORMAT; lpNameBuffer: String; var lpnSize: integer): integer;
External 'getusernameexa @ secur32.dll stdcall ';

Implementation Method: function GetUserName (): string;
Var
Ret: integer;
Begin
LpNameBuffer: = '000000 ';
LpNameBuffer: = lpNameBuffer + lpNameBuffer;
Ret: = Length (lpNameBuffer );
NameFormat: = NameSamCompatible;
If getusernameex (nameformat, lpnamebuffer, RET) <> 0 then
Begin
If lpnamebuffer [RET] = #0 then
Begin
RET: = ret-1;
End
Result: = copy (lpnamebuffer, 1, RET );
End
Else
Begin
Result: = '-1 ';
End
End;

There are two major problems in this implementation method:
First, you must initialize a string with sufficient length; otherwise, getusernameex cannot be written;
The second is that the username returned in WINXP system will have a "\ 0" character more than that returned in other systems.

2. In the WinXP system, you must use the computer name to connect to the local SQLServer2005 using OLEDB, but the local or localhost cannot be connected. This problem does not occur when ado.net is used and Express is connected.

3.change the executable file to setup.exe under the vistasystem and it will automatically run as an administrator.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.