Microsoft KB Archive/247221

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 13:50, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


PRB: Unattended Install of SQL Server 7.0 or MSDE 1.0 Stops Responding

Article ID: 247221

Article Last Modified on 6/23/2005



APPLIES TO

  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft Data Engine 1.0



This article was previously published under Q247221

SYMPTOMS

If a custom set up application, which invokes an unattended installation of SQL Server 7.0 or a MSDE 1.0 installation, fails to process all messages sent to it during the installation, the InstallShield setup of SQL Server or MSDE stops responding. If MSDE is being installed, Msdex86.exe expands all the files into a temporary directory but the setup does not progress beyond this point. When the computer stops responding, the Setup.log file (in the Windows root directory) is incomplete, and the Sqlstp.log file has not been created yet. If the application that calls Msdex86.exe, Msdealpha.exe, or Setupsql.exe is terminated, the set up continues and completes normally.

CAUSE

MSDE 1.0 and SQL Server 7.0 use InstallShield version 5.0. During installation several InstallShield components run that communicate their progress by broadcasting messages to all top-level windows. Because the messages are sent synchronously, if the calling application owns a top-level window and is not processing messages sent to its message loop, the InstallShield process stops responding until the application terminates.

WORKAROUND

The following C code snippet demonstrates how you can process all incoming messages to prevent InstallShield from hanging:

CreateProcess (NULL, szMSDECommandLine, NULL, 
        NULL, TRUE, 0, NULL, NULL, &si, &pi);
while (1) {
    while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) {
        TranslateMessage(&msg);
        // If it's a quit message, exit.
        if (msg.message == WM_QUIT)  
            return 1; 
        // Otherwise, dispatch the message.
        DispatchMessage (&msg);
    }
    // Wait for any message sent or posted to this queue 
    // or for the process handle to be signaled.
    if (MsgWaitForMultipleObjects (1, &pi.hProcess, 
        FALSE, 1000, QS_ALLINPUT) == WAIT_OBJECT_0)
        break;
}
                

Visual Basic code that performs the same function:

'---- declares
Private Declare Function CreateProcessA Lib "kernel32" _
  (ByVal lpApplicationName As Long, _
  ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, _
  ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
  ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
  ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, _ 
  lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
  (ByVal hObject As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Declare Function MsgWaitForMultipleObjects Lib "user32" _
  (ByVal nCount As Long, _ 
  ByRef pHandles As Long, ByVal fWaitAll As Long, _
  ByVal dwMilliseconds As Long, _
  ByVal dwWakeMask As Long) As Long
Public Const QS_SENDMESSAGE = &H40
Public Const QS_PAINT = &H20
Public Const QS_TIMER = &H10
Public Const QS_POSTMESSAGE = &H8
Public Const QS_MOUSEBUTTON = &H4
Public Const QS_MOUSEMOVE = &H2
Public Const QS_KEY = &H1
Public Const QS_SENDMESSAGE = &H40
Public Const QS_ALLINPUT = (QS_SENDMESSAGE Or QS_PAINT Or QS_TIMER _
  Or QS_POSTMESSAGE Or QS_MOUSEBUTTON Or QS_MOUSEMOVE Or QS_HOTKEY _
  Or QS_KEY)
Public Const WAIT_OBJECT_0 = 0&
Public Const WAIT_TIMEOUT = &H102&
Public Const WAIT_ABANDONED_0 = &H80&

'---- code
Dim Proc As PROCESS_INFORMATION
Dim Start As STARTUPINFO
Dim ret As Long
Dim OpenForms As Integer

Start.cb = Len(Start)
ret = CreateProcessA(0&, cmdline, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, _
  0&, 0&, Start, Proc)
Do
  If ret = (WAIT_OBJECT_0) Then Exit Do
    OpenForms = DoEvents()
  // Wait for any message sent or posted to this queue 
  // or for the process handle to be signaled.
  ret = MsgWaitForMultipleObjects(1&, Proc.hProcess, 0&, 1000, QS_ALLINPUT)
Loop
ret = CloseHandle(Proc.hProcess)
                

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.


Additional query words: setup SQL Desktop edition installation locks hang stops responding

Keywords: kbprb KB247221