]> cygwin.com Git - cygwin-apps/setup.git/blame - cygcalls.c
Remove Makefile
[cygwin-apps/setup.git] / cygcalls.c
CommitLineData
aa32874b
DD
1/*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16#include <windows.h>
17#include <stdio.h>
18
19static HINSTANCE cygwin_dll = 0;
20static char *cygwin_dll_name = 0;
21
22static void (*cygwin_dll_init_proc) ();
23static int (*mount_proc) (const char *win32_path, const char *posix_path, unsigned flags);
24static int (*umount_proc) (const char *posix_path);
25static int (*cygwin_umount_proc) (const char *posix_path, unsigned flags);
26static FILE * (*setmntent_proc) (const char *, const char *);
27static struct mntent * (*getmntent_proc) (FILE *);
28static int (*endmntent_proc) (FILE *);
29
30static void
31one (void *fp, char *name)
32{
33 int a;
34 *(int *)fp = a = (int) GetProcAddress (cygwin_dll, name);
35 if (!a)
36 {
37 fprintf (stderr, "error: unable to find `%s' in %s\n", name, cygwin_dll_name);
38 exit (1);
39 }
40}
41
42int
43cygcall_load_dll (char *name)
44{
45 /* This forces the dll to use a private "shared" area, avoiding version conflicts */
46 SetEnvironmentVariable("CYGWIN_TESTING", "1");
47
48 cygwin_dll = LoadLibrary (name);
49 if (cygwin_dll == 0)
50 return 1;
51 cygwin_dll_name = name;
52
53 one (&cygwin_dll_init_proc, "cygwin_dll_init");
54 one (&mount_proc, "mount");
55 one (&umount_proc, "umount");
56 one (&cygwin_umount_proc, "cygwin_umount");
57 one (&setmntent_proc, "setmntent");
58 one (&getmntent_proc, "getmntent");
59 one (&endmntent_proc, "endmntent");
60
61 cygwin_dll_init_proc ();
62
63 return 0;
64}
65
66int
67cygcall_unload_dll ()
68{
69 FreeLibrary (cygwin_dll);
70}
71
72int
73mount (const char *win32_path, const char *posix_path, unsigned flags)
74{
75 return mount_proc (win32_path, posix_path, flags);
76}
77
78int
79umount (const char *posix_path)
80{
81 return umount_proc (posix_path);
82}
83
84int
85cygwin_umount (const char *posix_path, unsigned flags)
86{
87 return cygwin_umount_proc (posix_path, flags);
88}
89
90FILE *
91setmntent (const char *__filep, const char *__type)
92{
93 return setmntent_proc (__filep, __type);
94}
95
96struct mntent *
97getmntent (FILE *__filep)
98{
99 return getmntent_proc (__filep);
100}
101
102int
103endmntent (FILE *__filep)
104{
105 return endmntent_proc (__filep);
106}
107
This page took 0.033856 seconds and 5 git commands to generate.