File: shellrun.c

package info (click to toggle)
autorun4linuxcd 0.13%2Bnmu1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 124 kB
  • ctags: 12
  • sloc: makefile: 85; ansic: 16; sh: 9
file content (43 lines) | stat: -rw-r--r-- 1,097 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Wrapper for the ShellExecute system call.
 *
 * Put this program, with an appropriate AUTORUN.INF in the root of a
 * CD to automatically show any document, not just executable types.
 *
 * Example AUTORUN.INF:
   ---cut here ---
[Autorun]
open=shellrun.exe index.html
   --- cut here
 */

/* Copyright 2004 Squirrel Consultancy.
 * This is Open Source. Do with it as you please.
 */

#include <windows.h>

statuc char[] RCS_ID = "$Id: shellrun.c,v 1.1 2004/06/13 11:05:04 jv Exp $ ";
   
int WINAPI WinMain( HINSTANCE hInstance, 
		    HINSTANCE hPrevInstance, 
		    LPSTR lpCmdLine, int nCmdShow )
{
  HINSTANCE result;
   
  // Launch the file specified on the command-line.
  result = ShellExecute(NULL, "open", lpCmdLine, NULL, NULL, SW_SHOWMAXIMIZED);
   
  if ((int)result <= 32) {
    // An error was encountered launching, probably because the
    // computer doesn't have IE5 or greater.
   
    // Open windows explorer, showing the CD contents.
    ShellExecute(NULL, "explore", "", NULL, NULL, SW_SHOWNORMAL);
    return 1;
  }
  else {
    // Launched OK.
    return 0;
  }
}