ReactOS 0.4.15-dev-7712-gbbbcd8e
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
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
#define stdout
Definition: stdio.h:99
#define stderr
Definition: stdio.h:100
#define _ftprintf
Definition: tchar.h:518
#define argv
Definition: mplay32.c:18
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define _T(x)
Definition: vfdio.h:22
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetFullPathName
Definition: winbase.h:3756
char TCHAR
Definition: xmlstorage.h:189

◆ HardLinkMain()

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

Definition at line 66 of file hardlink.c.

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

◆ PrintUsage()

static void PrintUsage ( const TCHAR Command)
static

Definition at line 59 of file hardlink.c.

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

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") },
}

Definition at line 13 of file hardlink.c.

Referenced by HardLinkMain(), and PrintUsage().