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>
16 #include <WINNT\afsreg.h>
19 main(int argc, char **argv) {
23 char mountRoot[64]="/afs";
26 if (argc < 2 || argc > 3) {
27 fprintf(stderr, "afsshare.exe <submount> [<afs mount path>]\n");
31 if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
32 AFSREG_CLT_OPENAFS_SUBKEY "\\Submounts",
35 REG_OPTION_NON_VOLATILE,
39 NULL) == ERROR_SUCCESS)
42 if (RegDeleteValue(hkSubmounts, argv[1])) {
43 fprintf(stderr,"Submount Deletion failure for [%s]: %lX",
44 argv[1], GetLastError());
45 RegCloseKey(hkSubmounts);
49 if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
50 AFSREG_CLT_SVC_PARAM_SUBKEY,
53 REG_OPTION_NON_VOLATILE,
57 NULL) == ERROR_SUCCESS)
59 DWORD dwSize = sizeof(mountRoot);
60 RegQueryValueEx (hkParameters, "MountRoot", NULL, NULL, (PBYTE)mountRoot, &dwSize);
61 RegCloseKey(hkParameters);
65 if ( !strncmp(mountRoot, argv[2], strlen(mountRoot)) )
66 mountstring = argv[2] + strlen(mountRoot);
68 mountstring = argv[2];
70 if (RegSetValueEx(hkSubmounts, argv[1], 0, REG_EXPAND_SZ, mountstring, strlen(mountstring)+1)) {
71 fprintf(stderr,"Submount Set failure for [%s]: %lX",
72 argv[1], GetLastError());
73 RegCloseKey(hkSubmounts);
77 RegCloseKey(hkSubmounts);
79 fprintf(stderr,"Submount access denied: %lX", GetLastError());