2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afs/param.h>
17 main(int argc, char **argv) {
21 char mountRoot[64]="/afs";
24 if (argc < 2 || argc > 3) {
25 fprintf(stderr, "afsshare.exe <submount> [<afs mount path>]\n");
29 if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
30 "SOFTWARE\\OpenAFS\\Client\\Submounts",
33 REG_OPTION_NON_VOLATILE,
37 NULL) == ERROR_SUCCESS)
40 if (RegDeleteValue(hkSubmounts, argv[1])) {
41 fprintf(stderr,"Submount Deletion failure for [%s]: %lX",
42 argv[1], GetLastError());
43 RegCloseKey(hkSubmounts);
47 if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
48 "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters",
51 REG_OPTION_NON_VOLATILE,
55 NULL) == ERROR_SUCCESS)
57 DWORD dwSize = sizeof(mountRoot);
58 RegQueryValueEx (hkParameters, "MountRoot", NULL, NULL, (PBYTE)mountRoot, &dwSize);
59 RegCloseKey(hkParameters);
63 if ( !strncmp(mountRoot, argv[2], strlen(mountRoot)) )
64 mountstring = argv[2] + strlen(mountRoot);
66 mountstring = argv[2];
68 if (RegSetValueEx(hkSubmounts, argv[1], 0, REG_EXPAND_SZ, mountstring, strlen(mountstring)+1)) {
69 fprintf(stderr,"Submount Set failure for [%s]: %lX",
70 argv[1], GetLastError());
71 RegCloseKey(hkSubmounts);
75 RegCloseKey(hkSubmounts);
77 fprintf(stderr,"Submount access denied: %lX", GetLastError());