blob: cc05646cb794098558d620f8cc6e5db4168eef29 (
plain)
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
|
/***********************************************************************/
/* */
/* Objective Caml */
/* */
/* File contributed by Lionel Fourquaux */
/* */
/* Copyright 2001 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License. */
/* */
/***********************************************************************/
/* $Id$ */
#include <windows.h>
#include <mlvalues.h>
#include <fail.h>
#include "unixsupport.h"
typedef
BOOL (WINAPI *tCreateHardLink)(
LPCTSTR lpFileName,
LPCTSTR lpExistingFileName,
LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
value unix_link(value path1, value path2) /* ML */
{
HMODULE hModKernel32;
tCreateHardLink pCreateHardLink;
hModKernel32 = GetModuleHandle("KERNEL32.DLL");
pCreateHardLink =
(tCreateHardLink) GetProcAddress(hModKernel32, "CreateHardLinkA");
if (pCreateHardLink == NULL)
invalid_argument("Unix.link not implemented");
if (! pCreateHardLink(String_val(path2), String_val(path1), NULL)) {
_dosmaperr(GetLastError());
uerror("link", path2);
}
return Val_unit;
}
|