ReactOS  0.4.12-dev-18-gf469aca
hardlink.c File Reference
#include "fsutil.h"
Include dependency graph for hardlink.c:

Go to the source code of this file.

Functions

static int CreateMain (int argc, const TCHAR *argv[])
 
static void PrintUsage (const TCHAR *Command)
 
int HardLinkMain (int argc, const TCHAR *argv[])
 

Variables

static HandlerProc CreateMain
 
static HandlerItem HandlersList []
 

Function Documentation

◆ CreateMain()

static int CreateMain ( int  argc,
const TCHAR argv[] 
)
static

Definition at line 20 of file hardlink.c.

21 {
23 
24  /* We need a source and a destination */
25  if (argc < 3)
26  {
27  _ftprintf(stderr, _T("Usage: fsutil hardlink create <new> <existing>\n"));
28  _ftprintf(stderr, _T("\tFor example: fsutil hardlink create c:\\target.txt c:\\source.txt\n"));
29  return 1;
30  }
31 
32  /* Get full names */
33  if (GetFullPathName(argv[1], MAX_PATH, Target, NULL) == 0)
34  {
36  return 1;
37  }
38 
39  if (GetFullPathName(argv[2], MAX_PATH, Source, NULL) == 0)
40  {
42  return 1;
43  }
44 
45  /* Simply delegate to kernel32 */
46  if (!CreateHardLink(Target, Source, NULL))
47  {
49  return 1;
50  }
51 
52  /* Print the status */
53  _ftprintf(stdout, _T("Hard link created for %s <=> %s\n"), Target, Source);
54 
55  return 0;
56 }
static int argc
Definition: ServiceArgs.c:12
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static char ** argv
Definition: ServiceArgs.c:11
FILE * stdout
smooth NULL
Definition: ftsmooth.c:416
#define _ftprintf
Definition: tchar.h:518
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define MAX_PATH
Definition: compat.h:26
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1067
#define GetFullPathName
Definition: winbase.h:3635
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
FILE * stderr
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3149

◆ HardLinkMain()

int HardLinkMain ( int  argc,
const TCHAR argv[] 
)

Definition at line 66 of file hardlink.c.

67 {
69  (sizeof(HandlersList) / sizeof(HandlersList[0])),
70  PrintUsage);
71 }
static int argc
Definition: ServiceArgs.c:12
static char ** argv
Definition: ServiceArgs.c:11
int FindHandler(int argc, const TCHAR *argv[], HandlerItem *HandlersList, int HandlerListCount, void(*UsageHelper)(const TCHAR *))
Definition: common.c:11

◆ PrintUsage()

static void PrintUsage ( const TCHAR Command)
static

Definition at line 59 of file hardlink.c.

Referenced by HardLinkMain().

60 {
62  (sizeof(HandlersList) / sizeof(HandlersList[0])));
63 }
void PrintDefaultUsage(const TCHAR *Command, const TCHAR *SubCommand, HandlerItem *HandlersList, int HandlerListCount)
Definition: common.c:102
Definition: shell.h:41
#define _T(x)
Definition: vfdio.h:22

Variable Documentation

◆ CreateMain

HandlerProc CreateMain
static

Definition at line 12 of file hardlink.c.

◆ HandlersList

HandlerItem HandlersList[]
static
Initial value:
=
{
{ CreateMain, _T("create"), _T("Create a new hard link") },
}
#define _T(x)
Definition: vfdio.h:22

Definition at line 13 of file hardlink.c.