Windows: AFS Redirector Support Tools
authorPeter Scott <pscott@kerneldrivers.com>
Thu, 15 Sep 2011 05:58:48 +0000 (01:58 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Thu, 15 Sep 2011 18:29:33 +0000 (11:29 -0700)
settrace, gettrace, objstatus, authgroup, and crash.

These tools are useful for debugging the system.

Change-Id: I2d62186a98f5561d579f7934ef568a54a3b099f1
Reviewed-on: http://gerrit.openafs.org/5440
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

15 files changed:
src/WINNT/afsrdr/tools/authgroup/AuthGroup.cpp [new file with mode: 0644]
src/WINNT/afsrdr/tools/authgroup/NTMakefile [new file with mode: 0644]
src/WINNT/afsrdr/tools/authgroup/authgroup.rc [new file with mode: 0644]
src/WINNT/afsrdr/tools/crash/NTMakefile [new file with mode: 0644]
src/WINNT/afsrdr/tools/crash/crash.cpp [new file with mode: 0644]
src/WINNT/afsrdr/tools/crash/crash.rc [new file with mode: 0644]
src/WINNT/afsrdr/tools/gettrace/NTMakefile [new file with mode: 0644]
src/WINNT/afsrdr/tools/gettrace/gettrace.cpp [new file with mode: 0644]
src/WINNT/afsrdr/tools/gettrace/gettrace.rc [new file with mode: 0644]
src/WINNT/afsrdr/tools/objstatus/NTMakefile [new file with mode: 0644]
src/WINNT/afsrdr/tools/objstatus/ObjectStatus.cpp [new file with mode: 0644]
src/WINNT/afsrdr/tools/objstatus/objstatus.rc [new file with mode: 0644]
src/WINNT/afsrdr/tools/settrace/NTMakefile [new file with mode: 0644]
src/WINNT/afsrdr/tools/settrace/settrace.cpp [new file with mode: 0644]
src/WINNT/afsrdr/tools/settrace/settrace.rc [new file with mode: 0644]

diff --git a/src/WINNT/afsrdr/tools/authgroup/AuthGroup.cpp b/src/WINNT/afsrdr/tools/authgroup/AuthGroup.cpp
new file mode 100644 (file)
index 0000000..efd5daf
--- /dev/null
@@ -0,0 +1,518 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <shlwapi.h>
+#include <winioctl.h>
+
+#include <rpc.h>
+
+#include "AFSUserDefines.h"
+#include "AFSUserIoctl.h"
+#include "AFSUserStructs.h"
+
+void
+Usage()
+{
+
+    printf("Usage: AFSAuthGroup < /sid <SID to use> | /ag <Auth Group GUID> /session <Session ID> | /thread <Thread Specific> | /active <Set Active> | \
+            /q <Query Active AuthGroup> | /l <Query AuthGroup List> | /c <Create new AuthGroup on process or thread> | /s <Set AuthGroup on process or thread> | \
+            /r <Reset AuthGroup list on process or thread> | /n <Create new AuthGroup>\n");
+
+    return;
+}
+
+int main(int argc, char* argv[])
+{
+
+    ULONG rc = 0;
+    DWORD bytesReturned = 0;
+    HANDLE hControlDevice = NULL;
+    char *pBuffer = NULL;
+    DWORD dwError = 0, dwIndex = 0;
+    BOOLEAN bQueryActiveAuthGroup = FALSE;
+    BOOLEAN bQueryProcessAuthGroupList = FALSE;
+    GUID stAuthGroup;
+    unsigned char *pchGUID = NULL;
+    WCHAR wchUserSID[ 256];
+    DWORD dwSessionId = (DWORD)-1;
+    BOOLEAN bThreadSpecific = FALSE;
+    BOOLEAN bSetActive = FALSE;
+    BOOLEAN bCreateSetAuthGroup = FALSE;
+    BOOLEAN bSetAuthGroup = FALSE;
+    BOOLEAN bResetAuthGroup = FALSE;
+    BOOLEAN bCreateAuthGroup = FALSE;
+    AFSAuthGroupRequestCB *pAuthGroupRequest = NULL;
+    DWORD dwAuthGroupRequestLen = 0;
+    char chGUID[ 256];
+
+    if( argc < 2)
+    {
+        Usage();
+        return 0;
+    }
+
+    dwIndex = 1;
+
+    dwError = 1;
+
+    memset( wchUserSID, '\0', 256 * sizeof( WCHAR));
+
+    memset( chGUID, '\0', 256);
+
+    while( dwIndex < (DWORD)argc)
+    {
+
+        if( _stricmp(argv[ dwIndex], "/q") == 0)
+        {
+            bQueryActiveAuthGroup = TRUE;
+        }
+        else if( _stricmp(argv[ dwIndex], "/l") == 0)
+        {
+            bQueryProcessAuthGroupList = TRUE;
+        }
+        else if( _stricmp(argv[ dwIndex], "/c") == 0)
+        {
+            bCreateSetAuthGroup = TRUE;
+        }
+        else if( _stricmp(argv[ dwIndex], "/s") == 0)
+        {
+            bSetAuthGroup = TRUE;
+        }
+        else if( _stricmp(argv[ dwIndex], "/r") == 0)
+        {
+            bResetAuthGroup = TRUE;
+        }
+        else if( _stricmp(argv[ dwIndex], "/n") == 0)
+        {
+            bCreateAuthGroup = TRUE;
+        }
+        else if( _stricmp( argv[ dwIndex], "/sid") == 0)
+        {
+
+            dwIndex++;
+
+            if( MultiByteToWideChar( CP_ACP,
+                                    MB_PRECOMPOSED,
+                                    argv[dwIndex],
+                                    -1,
+                                    wchUserSID,
+                                    (int)strlen( argv[dwIndex]) + 1) == 0)
+            {
+                dwError = -1;
+                break;
+            }
+        }
+        else if( _stricmp( argv[ dwIndex], "/ag") == 0)
+        {
+
+            dwIndex++;
+
+            strcpy( chGUID,
+                    argv[dwIndex]);
+        }
+        else if( _stricmp( argv[ dwIndex], "/session") == 0)
+        {
+
+            dwIndex++;
+
+            if( !StrToIntExA( argv[ dwIndex],
+                              STIF_SUPPORT_HEX,
+                              (int *)&dwSessionId))
+            {
+
+                dwError = -1;
+                break;
+            }
+        }
+        else if( _stricmp( argv[ dwIndex], "/thread") == 0)
+        {
+
+            dwIndex++;
+
+            bThreadSpecific = TRUE;
+        }
+        else if( _stricmp( argv[ dwIndex], "/active") == 0)
+        {
+
+            dwIndex++;
+
+            bSetActive = TRUE;
+        }
+        else
+        {
+            Usage();
+            dwError = -1;
+            break;
+        }
+
+        dwIndex++;
+    }
+
+    if( dwError == -1)
+    {
+        return 0;
+    }
+
+    hControlDevice = CreateFile( AFS_SYMLINK,
+                                 GENERIC_READ | GENERIC_WRITE,
+                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                 NULL,
+                                 OPEN_EXISTING,
+                                 0,
+                                 NULL );
+
+    if( hControlDevice == INVALID_HANDLE_VALUE)
+    {
+
+        printf( "AFSAuthGroup: Failed to open control device error: %d\n", GetLastError());
+
+        return 0;
+    }
+
+    if( bQueryActiveAuthGroup)
+    {
+        dwError = DeviceIoControl( hControlDevice,
+                                   IOCTL_AFS_AUTHGROUP_SID_QUERY,
+                                   NULL,
+                                   0,
+                                   &stAuthGroup,
+                                   sizeof( GUID),
+                                   &bytesReturned,
+                                   NULL);
+
+        if( !dwError)
+        {
+            printf( "AFSAuthGroup Failed to query auth group error %d\n", GetLastError());
+        }
+        else
+        {
+
+            if( UuidToString( (UUID *)&stAuthGroup,
+                              &pchGUID) == RPC_S_OK)
+            {
+                printf("AFSAuthGroup Successfully retrieved auth group %s\n", pchGUID);
+                RpcStringFree( &pchGUID);
+            }
+            else
+            {
+                printf("AFSAuthGroup Failed to convert GUID to string\n");
+            }
+        }
+    }
+    else if( bQueryProcessAuthGroupList)
+    {
+
+        pBuffer = (char *)malloc( 0x1000);
+
+        if( pBuffer == NULL)
+        {
+            printf("AFSAuthGroup Failed to allocate query buffer\n");
+            goto cleanup;
+        }
+
+        dwError = DeviceIoControl( hControlDevice,
+                                   IOCTL_AFS_AUTHGROUP_QUERY,
+                                   NULL,
+                                   0,
+                                   pBuffer,
+                                   0x1000,
+                                   &bytesReturned,
+                                   NULL);
+
+        if( !dwError)
+        {
+            printf( "AFSAuthGroup Failed to query auth group list error %d\n", GetLastError());
+        }
+        else
+        {
+
+            GUID *pCurrentGUID = (GUID *)pBuffer;
+
+            if( bytesReturned == 0)
+            {
+                printf("AFSAuthGroup No custom auth groups assigned to process\n");
+            }
+            else
+            {
+                while( bytesReturned > 0)
+                {
+                    if( UuidToString( (UUID *)pCurrentGUID,
+                                      &pchGUID) == RPC_S_OK)
+                    {
+                        printf("AFSAuthGroup Successfully retrieved auth group list entry %s\n", pchGUID);
+                        RpcStringFree( &pchGUID);
+                    }
+                    else
+                    {
+                        printf("AFSAuthGroup Failed to convert GUID to string\n");
+                    }
+
+                    pCurrentGUID++;
+
+                    bytesReturned -= sizeof( GUID);
+                }
+            }
+        }
+    }
+    else if( bCreateSetAuthGroup)
+    {
+
+        dwAuthGroupRequestLen = (DWORD)(sizeof( AFSAuthGroupRequestCB) +
+                                        (wcslen( wchUserSID) * sizeof( WCHAR)));
+
+        pAuthGroupRequest = (AFSAuthGroupRequestCB *)malloc( dwAuthGroupRequestLen);
+
+        if( pAuthGroupRequest == NULL)
+        {
+            printf("AFSAuthGroup Failed to allocate request block\n");
+            goto cleanup;
+        }
+
+        memset( pAuthGroupRequest,
+                '\0',
+                dwAuthGroupRequestLen);
+
+        pAuthGroupRequest->SIDLength = (USHORT)(wcslen( wchUserSID) * sizeof( WCHAR));
+
+        if( pAuthGroupRequest->SIDLength > 0)
+        {
+            wcscpy( &pAuthGroupRequest->SIDString[ 0], wchUserSID);
+        }
+
+        pAuthGroupRequest->SessionId = dwSessionId;
+
+        if( bThreadSpecific)
+        {
+            pAuthGroupRequest->Flags |= AFS_PAG_FLAGS_THREAD_AUTH_GROUP;
+        }
+
+        if( bSetActive)
+        {
+            pAuthGroupRequest->Flags |= AFS_PAG_FLAGS_SET_AS_ACTIVE;
+        }
+
+        dwError = DeviceIoControl( hControlDevice,
+                                   IOCTL_AFS_AUTHGROUP_CREATE_AND_SET,
+                                   pAuthGroupRequest,
+                                   dwAuthGroupRequestLen,
+                                   NULL,
+                                   0,
+                                   &bytesReturned,
+                                   NULL);
+
+        if( !dwError)
+        {
+            printf( "AFSAuthGroup Failed to create and set auth group error %d\n", GetLastError());
+        }
+        else
+        {
+            printf( "AFSAuthGroup Successfully create and set auth group\n");
+        }
+
+        free( pAuthGroupRequest);
+    }
+    else if( bSetAuthGroup)
+    {
+
+        if( strlen( chGUID) == 0)
+        {
+            printf("AFSAuthGroup Failed to specify AuthGroup GUID when setting\n");
+            goto cleanup;
+        }
+
+        dwAuthGroupRequestLen = sizeof( AFSAuthGroupRequestCB);
+
+        pAuthGroupRequest = (AFSAuthGroupRequestCB *)malloc( dwAuthGroupRequestLen);
+
+        if( pAuthGroupRequest == NULL)
+        {
+            printf("AFSAuthGroup Failed to allocate request block\n");
+            goto cleanup;
+        }
+
+        memset( pAuthGroupRequest,
+                '\0',
+                dwAuthGroupRequestLen);
+
+        if( bThreadSpecific)
+        {
+            pAuthGroupRequest->Flags |= AFS_PAG_FLAGS_THREAD_AUTH_GROUP;
+        }
+
+        if( bSetActive)
+        {
+            pAuthGroupRequest->Flags |= AFS_PAG_FLAGS_SET_AS_ACTIVE;
+        }
+
+        if( UuidFromString( (unsigned char *)chGUID,
+                            &pAuthGroupRequest->AuthGroup) != RPC_S_OK)
+        {
+            printf("AFSAuthGroup Failed to convert string to GUID\n");
+            free( pAuthGroupRequest);
+            goto cleanup;
+        }
+
+        dwError = DeviceIoControl( hControlDevice,
+                                   IOCTL_AFS_AUTHGROUP_SET,
+                                   pAuthGroupRequest,
+                                   dwAuthGroupRequestLen,
+                                   NULL,
+                                   0,
+                                   &bytesReturned,
+                                   NULL);
+
+        if( !dwError)
+        {
+            printf( "AFSAuthGroup Failed to set auth group error %d\n", GetLastError());
+        }
+        else
+        {
+            printf( "AFSAuthGroup Successfully set auth group\n");
+        }
+
+        free( pAuthGroupRequest);
+    }
+    else if( bResetAuthGroup)
+    {
+
+        dwAuthGroupRequestLen = sizeof( AFSAuthGroupRequestCB);
+
+        pAuthGroupRequest = (AFSAuthGroupRequestCB *)malloc( dwAuthGroupRequestLen);
+
+        if( pAuthGroupRequest == NULL)
+        {
+            printf("AFSAuthGroup Failed to allocate request block\n");
+            goto cleanup;
+        }
+
+        memset( pAuthGroupRequest,
+                '\0',
+                dwAuthGroupRequestLen);
+
+        if( bThreadSpecific)
+        {
+            pAuthGroupRequest->Flags |= AFS_PAG_FLAGS_THREAD_AUTH_GROUP;
+        }
+
+        dwError = DeviceIoControl( hControlDevice,
+                                   IOCTL_AFS_AUTHGROUP_RESET,
+                                   pAuthGroupRequest,
+                                   dwAuthGroupRequestLen,
+                                   NULL,
+                                   0,
+                                   &bytesReturned,
+                                   NULL);
+
+        if( !dwError)
+        {
+            printf( "AFSAuthGroup Failed to reset auth group error %d\n", GetLastError());
+        }
+        else
+        {
+            printf( "AFSAuthGroup Successfully reset auth group\n");
+        }
+
+        free( pAuthGroupRequest);
+    }
+    else if( bCreateAuthGroup)
+    {
+
+        dwAuthGroupRequestLen = (DWORD)(sizeof( AFSAuthGroupRequestCB) +
+                                        (wcslen( wchUserSID) * sizeof( WCHAR)));
+
+        pAuthGroupRequest = (AFSAuthGroupRequestCB *)malloc( dwAuthGroupRequestLen);
+
+        if( pAuthGroupRequest == NULL)
+        {
+            printf("AFSAuthGroup Failed to allocate request block\n");
+            goto cleanup;
+        }
+
+        memset( pAuthGroupRequest,
+                '\0',
+                dwAuthGroupRequestLen);
+
+        pAuthGroupRequest->SIDLength = (USHORT)((wcslen( wchUserSID) * sizeof( WCHAR)));
+
+        if( pAuthGroupRequest->SIDLength > 0)
+        {
+            wcscpy( &pAuthGroupRequest->SIDString[ 0], wchUserSID);
+        }
+
+        pAuthGroupRequest->SessionId = dwSessionId;
+
+        dwError = DeviceIoControl( hControlDevice,
+                                   IOCTL_AFS_AUTHGROUP_SID_CREATE,
+                                   pAuthGroupRequest,
+                                   dwAuthGroupRequestLen,
+                                   NULL,
+                                   0,
+                                   &bytesReturned,
+                                   NULL);
+
+        if( !dwError)
+        {
+            printf( "AFSAuthGroup Failed to create auth group error %d\n", GetLastError());
+        }
+        else
+        {
+            printf( "AFSAuthGroup Successfully create auth group\n");
+        }
+
+        free( pAuthGroupRequest);
+    }
+    else
+    {
+        printf("AFSAuthGroup Invalid request parameters\n");
+        Usage();
+    }
+
+cleanup:
+
+    if( pBuffer != NULL)
+    {
+        free( pBuffer);
+    }
+
+    if( hControlDevice != NULL)
+    {
+        CloseHandle( hControlDevice);
+    }
+
+       return 0;
+}
diff --git a/src/WINNT/afsrdr/tools/authgroup/NTMakefile b/src/WINNT/afsrdr/tools/authgroup/NTMakefile
new file mode 100644 (file)
index 0000000..c045e8e
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright (c) 2011 Kernel Drivers, LLC.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright notice,
+#   this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice,
+#   this list of conditions and the following disclaimer in the
+#   documentation
+#   and/or other materials provided with the distribution.
+# - Neither the name of Kernel Drivers, LLC nor the names of its
+#   contributors may be
+#   used to endorse or promote products derived from this software without
+#   specific prior written permission from Kernel Drivers, LLC.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# include the primary makefile
+RELDIR=WINNT\afsrdr\tools\authgroup
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+############################################################################
+#
+# BUILD TARSETS
+#
+
+AUTHGROUP = ..\..\build\$(CPU)\authgroup.exe
+
+AUTHGROUPOBJS = \
+       $(OUT)\authgroup.obj
+
+$(AUTHGROUPOBJS): $$(@B).cpp
+       $(C2OBJ)  -I..\..\common $**
+
+############################################################################
+
+$(AUTHGROUP) : $(AUTHGROUPOBJS) $(OUT)\authgroup.res
+       $(EXECONLINK) $(LINKOPTS) advapi32.lib kernel32.lib user32.lib rpcrt4.lib Shlwapi.lib
+        $(_VC_MANIFEST_EMBED_EXE)
+       $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install : $(AUTHGROUP)
+
+############################################################################
+#
+# Dependencies
+#
+
+$(OUT)\authgroup.res : authgroup.rc AFS_component_version_number.h
diff --git a/src/WINNT/afsrdr/tools/authgroup/authgroup.rc b/src/WINNT/afsrdr/tools/authgroup/authgroup.rc
new file mode 100644 (file)
index 0000000..c44f717
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Define VERSIONINFO resource */
+
+#define  AFS_VERINFO_FILE_DESCRIPTION "AFS Redirector AuthGroup"
+#define AFS_VERINFO_NAME "AuthGroup"
+#define AFS_VERINFO_FILENAME "authgroup.exe"
+
+#include "..\..\AFS_component_version_number.h"
+#include "..\..\..\..\config\NTVersioninfo.rc"
diff --git a/src/WINNT/afsrdr/tools/crash/NTMakefile b/src/WINNT/afsrdr/tools/crash/NTMakefile
new file mode 100644 (file)
index 0000000..0a18f93
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright 2004, OpenAFS.ORG and others.
+# All Rights Reserved.
+#
+# This software has been released under the terms of the IBM Public
+# License.  For details, see the LICENSE file in the top-level source
+# directory or online at http://www.openafs.org/dl/license10.html
+
+# include the primary makefile
+RELDIR=WINNT\afsrdr\tools\crash
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+############################################################################
+#
+# BUILD TARGETS
+#
+
+CRASH = ..\..\build\$(CPU)\crash.exe
+
+CRASHOBJS = \
+       $(OUT)\crash.obj
+
+$(CRASHOBJS): $$(@B).cpp
+       $(C2OBJ)  -I..\..\common $**
+
+############################################################################
+
+$(CRASH) : $(CRASHOBJS) $(OUT)\crash.res
+       $(EXECONLINK) $(LINKOPTS)
+        $(_VC_MANIFEST_EMBED_EXE)
+       $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install : $(CRASH)
+
+############################################################################
+#
+# Dependencies
+#
+
+$(OUT)\crash.res : crash.rc AFS_component_version_number.h
diff --git a/src/WINNT/afsrdr/tools/crash/crash.cpp b/src/WINNT/afsrdr/tools/crash/crash.cpp
new file mode 100644 (file)
index 0000000..df58466
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <devioctl.h>
+
+#include "AFSUserDefines.h"
+#include "AFSUserIoctl.h"
+
+int main(int argc, char* argv[])
+{
+
+    ULONG rc = 0;
+    DWORD bytesReturned = 0;
+    HANDLE hControlDevice = NULL;
+    DWORD dwError = 0;
+
+    hControlDevice = CreateFile( AFS_SYMLINK,
+                                 GENERIC_READ | GENERIC_WRITE,
+                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                 NULL,
+                                 OPEN_EXISTING,
+                                 0,
+                                 NULL );
+
+    if( hControlDevice == INVALID_HANDLE_VALUE)
+    {
+
+        printf( "Crash: Failed to open control device error: %d\n", GetLastError());
+
+        return 0;
+    }
+
+
+    DeviceIoControl( hControlDevice,
+                     IOCTL_AFS_FORCE_CRASH,
+                     NULL,
+                     0,
+                     NULL,
+                     0,
+                     &bytesReturned,
+                     NULL);
+
+    CloseHandle( hControlDevice);
+
+    return 0;
+}
diff --git a/src/WINNT/afsrdr/tools/crash/crash.rc b/src/WINNT/afsrdr/tools/crash/crash.rc
new file mode 100644 (file)
index 0000000..8c92086
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Define VERSIONINFO resource */
+
+#define  AFS_VERINFO_FILE_DESCRIPTION "AFS Redirector Crash"
+#define AFS_VERINFO_NAME "Crash"
+#define AFS_VERINFO_FILENAME "crash.exe"
+
+#include "..\..\AFS_component_version_number.h"
+#include "..\..\..\..\config\NTVersioninfo.rc"
diff --git a/src/WINNT/afsrdr/tools/gettrace/NTMakefile b/src/WINNT/afsrdr/tools/gettrace/NTMakefile
new file mode 100644 (file)
index 0000000..37e4e4b
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright 2004, OpenAFS.ORG and others.
+# All Rights Reserved.
+#
+# This software has been released under the terms of the IBM Public
+# License.  For details, see the LICENSE file in the top-level source
+# directory or online at http://www.openafs.org/dl/license10.html
+
+# include the primary makefile
+RELDIR=WINNT\afsrdr\tools\gettrace
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+############################################################################
+#
+# BUILD TARGETS
+#
+
+GETTRACE = ..\..\build\$(CPU)\gettrace.exe
+
+GETTRACEOBJS = \
+       $(OUT)\gettrace.obj
+
+$(GETTRACEOBJS): $$(@B).cpp
+       $(C2OBJ)  -I..\..\common $**
+
+############################################################################
+
+$(GETTRACE) : $(GETTRACEOBJS) $(OUT)\gettrace.res
+       $(EXECONLINK) $(LINKOPTS) shlwapi.lib
+        $(_VC_MANIFEST_EMBED_EXE)
+       $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install : $(GETTRACE)
+
+############################################################################
+#
+# Dependencies
+#
+
+$(OUT)\gettrace.res : gettrace.rc AFS_component_version_number.h
diff --git a/src/WINNT/afsrdr/tools/gettrace/gettrace.cpp b/src/WINNT/afsrdr/tools/gettrace/gettrace.cpp
new file mode 100644 (file)
index 0000000..4f16755
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <shlwapi.h>
+#include <devioctl.h>
+
+#include "AFSUserDefines.h"
+#include "AFSUserIoctl.h"
+
+int main(int argc, char* argv[])
+{
+
+    ULONG rc = 0;
+    DWORD bytesReturned = 0;
+    HANDLE hControlDevice = NULL;
+    char *pBuffer = NULL;
+    DWORD dwError = 0;
+    int   dwBufferSize = 2001;
+
+    if( argc > 1)
+    {
+
+        if( !strcmp(argv[ 1], "?"))
+        {
+
+            printf("Usage:GetTrace <Buffer size in KB (Default: 2000)>\n");
+
+            return 0;
+        }
+        else
+        {
+
+            StrToIntExA( argv[ 1], STIF_SUPPORT_HEX, &dwBufferSize);
+
+            if ( dwBufferSize == 0)
+            {
+
+                printf("Usage:GetTrace <Buffer size in KB (Default: 2000)>\n");
+
+                return 1;
+            }
+        }
+    }
+
+    hControlDevice = CreateFile( AFS_SYMLINK,
+                                 GENERIC_READ | GENERIC_WRITE,
+                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                 NULL,
+                                 OPEN_EXISTING,
+                                 0,
+                                 NULL );
+
+    if( hControlDevice == INVALID_HANDLE_VALUE)
+    {
+
+        printf( "GetBuffer: Failed to open control device error: %d\n", GetLastError());
+
+        return 0;
+    }
+
+    dwBufferSize *= 1024 + 1;
+
+    pBuffer = (char *)malloc( dwBufferSize);
+
+    if( pBuffer != NULL)
+    {
+
+        dwError = DeviceIoControl( hControlDevice,
+                                   IOCTL_AFS_GET_TRACE_BUFFER,
+                                   NULL,
+                                   0,
+                                   pBuffer,
+                                   dwBufferSize,
+                                   &bytesReturned,
+                                   NULL);
+
+        if( !dwError)
+        {
+
+            printf( "GetBuffer Failed to retrieve buffer %d\n", GetLastError());
+        }
+        else
+        {
+
+            pBuffer[bytesReturned] = '\0';
+
+            printf( "%s", pBuffer);
+        }
+
+        free( pBuffer);
+    }
+
+    CloseHandle( hControlDevice);
+
+    return 0;
+}
+
diff --git a/src/WINNT/afsrdr/tools/gettrace/gettrace.rc b/src/WINNT/afsrdr/tools/gettrace/gettrace.rc
new file mode 100644 (file)
index 0000000..9cc0d76
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Define VERSIONINFO resource */
+
+#define  AFS_VERINFO_FILE_DESCRIPTION "AFS Redirector GetTrace"
+#define AFS_VERINFO_NAME "GetTrace"
+#define AFS_VERINFO_FILENAME "gettrace.exe"
+
+#include "..\..\AFS_component_version_number.h"
+#include "..\..\..\..\config\NTVersioninfo.rc"
diff --git a/src/WINNT/afsrdr/tools/objstatus/NTMakefile b/src/WINNT/afsrdr/tools/objstatus/NTMakefile
new file mode 100644 (file)
index 0000000..93e56c7
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright (c) 2011 Kernel Drivers, LLC.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright notice,
+#   this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice,
+#   this list of conditions and the following disclaimer in the
+#   documentation
+#   and/or other materials provided with the distribution.
+# - Neither the name of Kernel Drivers, LLC nor the names of its
+#   contributors may be
+#   used to endorse or promote products derived from this software without
+#   specific prior written permission from Kernel Drivers, LLC.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# include the primary makefile
+RELDIR=WINNT\afsrdr\tools\authgroup
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+############################################################################
+#
+# BUILD TARSETS
+#
+
+OBJSTATUS = ..\..\build\$(CPU)\objstatus.exe
+
+OBJSTATUSOBJS = \
+       $(OUT)\ObjectStatus.obj
+
+$(OBJSTATUSOBJS): $$(@B).cpp
+       $(C2OBJ)  -I..\..\common $**
+
+############################################################################
+
+$(OBJSTATUS) : $(OBJSTATUSOBJS) $(OUT)\objstatus.res
+       $(EXECONLINK) $(LINKOPTS) advapi32.lib kernel32.lib user32.lib Shlwapi.lib
+        $(_VC_MANIFEST_EMBED_EXE)
+       $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install : $(OBJSTATUS)
+
+############################################################################
+#
+# Dependencies
+#
+
+$(OUT)\objstatus.res : objstatus.rc AFS_component_version_number.h
diff --git a/src/WINNT/afsrdr/tools/objstatus/ObjectStatus.cpp b/src/WINNT/afsrdr/tools/objstatus/ObjectStatus.cpp
new file mode 100644 (file)
index 0000000..35f5050
--- /dev/null
@@ -0,0 +1,523 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <windows.h>
+#include <winioctl.h>
+#include <stdio.h>
+#include <shlwapi.h>
+
+#include "AFSUserDefines.h"
+#include "AFSUserIoctl.h"
+#include "AFSUserStructs.h"
+
+bool
+ParseFID( char *FidName,
+          AFSFileID *FID);
+
+char *
+GetAFSFileType( IN DWORD FileType);
+
+void
+Usage()
+{
+
+    printf("Usage: AFSObjectStatus </f FID (Cell.Volume.VNode.Unique)> | </n Full file name> /i <Invalidate entry by FID>\n");
+
+    return;
+}
+
+int
+main(int argc, char* argv[])
+{
+
+    ULONG rc = 0;
+    DWORD bytesReturned = 0;
+    HANDLE hControlDevice = NULL;
+    char *pBuffer = NULL;
+    DWORD dwError = 0, dwIndex = 0, dwBufferSize = 0;
+    AFSGetStatusInfoCB *pGetStatusInfo = NULL;
+    AFSStatusInfoCB *pStatusInfo = NULL;
+    AFSFileID stFID;
+    BOOLEAN bUseFID = false;
+    WCHAR wchFileName[ 256];
+    AFSInvalidateCacheCB *pInvalidate = NULL;
+    bool bInvalidate = false;
+    DWORD dwIOControl = 0;
+
+    if( argc < 2)
+    {
+
+        Usage();
+
+        return 0;
+    }
+
+    dwIndex = 1;
+
+    dwError = 1;
+
+    while( dwIndex < (DWORD)argc)
+    {
+
+        if( _stricmp(argv[ dwIndex], "/f") == 0)
+        {
+
+            if( !ParseFID( argv[ ++dwIndex],
+                           &stFID))
+            {
+
+                printf("AFSObjectStatus Failed to parse fid %s\n", argv[ dwIndex]);
+
+                dwError = -1;
+
+                break;
+            }
+
+            bUseFID = true;
+        }
+        else if( _stricmp(argv[ dwIndex], "/n") == 0)
+        {
+
+            dwIndex++;
+
+            if( MultiByteToWideChar( CP_ACP,
+                                    MB_PRECOMPOSED,
+                                    argv[ dwIndex],
+                                    -1,
+                                    wchFileName,
+                                    (int)strlen( argv[ dwIndex]) + 1) == 0)
+            {
+
+                printf("AFSObjectStatus Failed to map string %d\n", GetLastError());
+
+                dwError = -1;
+
+                break;
+            }
+        }
+        else if( _stricmp(argv[ dwIndex], "/i") == 0)
+        {
+
+            bInvalidate = true;
+        }
+        else
+        {
+
+            Usage();
+
+            dwError = -1;
+
+            break;
+        }
+
+        dwIndex++;
+    }
+
+    if( dwError == -1)
+    {
+
+        return 0;
+    }
+
+    if( bInvalidate &&
+        !bUseFID)
+    {
+
+        printf("AFSObjectStatus Must specify FID when performing invalidation\n");
+
+        return 0;
+    }
+
+    hControlDevice = CreateFile( AFS_SYMLINK,
+                                 GENERIC_READ | GENERIC_WRITE,
+                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                 NULL,
+                                 OPEN_EXISTING,
+                                 0,
+                                 NULL );
+
+    if( hControlDevice == INVALID_HANDLE_VALUE)
+    {
+
+        printf( "AFSObjectStatus: Failed to open control device error: %d\n", GetLastError());
+
+        return 0;
+    }
+
+    dwBufferSize = 1024;
+
+    pBuffer = (char *)malloc( dwBufferSize);
+
+    if( pBuffer != NULL)
+    {
+
+        if( bInvalidate)
+        {
+
+            pInvalidate = (AFSInvalidateCacheCB *)pBuffer;
+
+            pInvalidate->FileID = stFID;
+
+            pInvalidate->FileType = 0;
+
+            pInvalidate->Reason = AFS_INVALIDATE_FLUSHED;
+
+            pInvalidate->WholeVolume = false;
+
+            dwError = DeviceIoControl( hControlDevice,
+                                       IOCTL_AFS_INVALIDATE_CACHE,
+                                       pBuffer,
+                                       sizeof( AFSInvalidateCacheCB),
+                                       NULL,
+                                       0,
+                                       &bytesReturned,
+                                       NULL);
+
+            if( !dwError)
+            {
+                printf( "AFSObjectStatus Failed to invalidate object error %d\n", GetLastError());
+            }
+            else
+            {
+                printf("AFSObjectStatus Successfully invalidated object\n");
+            }
+        }
+        else
+        {
+
+            pGetStatusInfo = (AFSGetStatusInfoCB *)pBuffer;
+
+            memset( pGetStatusInfo, '\0', sizeof( AFSGetStatusInfoCB));
+
+            if( bUseFID)
+            {
+                pGetStatusInfo->FileID = stFID;
+            }
+            else
+            {
+                pGetStatusInfo->FileNameLength = (USHORT)(wcslen( wchFileName) * sizeof( WCHAR));
+
+                dwIndex = 0;
+
+                if( wchFileName[ 0] == L'\\' &&
+                    wchFileName[ 1] == L'\\')
+                {
+                    dwIndex = 1;
+
+                    pGetStatusInfo->FileNameLength -= sizeof( WCHAR);
+                }
+
+                memcpy( pGetStatusInfo->FileName,
+                        &wchFileName[ dwIndex],
+                        pGetStatusInfo->FileNameLength);
+            }
+
+            dwError = DeviceIoControl( hControlDevice,
+                                       IOCTL_AFS_GET_OBJECT_INFORMATION,
+                                       pBuffer,
+                                       sizeof( AFSGetStatusInfoCB) + pGetStatusInfo->FileNameLength,
+                                       pBuffer,
+                                       dwBufferSize,
+                                       &bytesReturned,
+                                       NULL);
+
+            if( !dwError)
+            {
+                printf( "AFSObjectStatus Failed to retrieve buffer %d\n", GetLastError());
+            }
+            else
+            {
+
+                pStatusInfo = (AFSStatusInfoCB *)pBuffer;
+
+                if( bUseFID)
+                {
+                    printf("AFS ObjectStatus Results: FID (%08lX.%08lX.%08lX.%08lX)\n", stFID.Cell, stFID.Volume, stFID.Vnode, stFID.Unique);
+                }
+                else
+                {
+                    printf("AFS ObjectStatus Results: Name (%S)\n", wchFileName);
+                }
+
+                printf("\n");
+                printf("\t\t FID: %08lX.%08lX.%08lX.%08lX\n",
+                                        pStatusInfo->FileId.Cell,
+                                        pStatusInfo->FileId.Volume,
+                                        pStatusInfo->FileId.Vnode,
+                                        pStatusInfo->FileId.Unique);
+
+                printf("\t\t TargetFID: %08lX.%08lX.%08lX.%08lX\n",
+                                        pStatusInfo->TargetFileId.Cell,
+                                        pStatusInfo->TargetFileId.Volume,
+                                        pStatusInfo->TargetFileId.Vnode,
+                                        pStatusInfo->TargetFileId.Unique);
+
+                printf("\t\t Expiration: %08lX-%08lX\n", pStatusInfo->Expiration.HighPart, pStatusInfo->Expiration.LowPart);
+
+                printf("\t\t Data Version: %08lX-%08lX\n", pStatusInfo->DataVersion.HighPart, pStatusInfo->DataVersion.LowPart);
+
+                printf("\t\t FileType: %s - %08lX\n", GetAFSFileType( pStatusInfo->FileType), pStatusInfo->FileType);
+
+                printf("\t\t Object Flags: %08lX\n", pStatusInfo->ObjectFlags);
+
+                printf("\t\t Create Time: %08lX-%08lX\n", pStatusInfo->CreationTime.HighPart, pStatusInfo->CreationTime.LowPart);
+
+                printf("\t\t Last Access Time: %08lX-%08lX\n", pStatusInfo->LastAccessTime.HighPart, pStatusInfo->LastAccessTime.LowPart);
+
+                printf("\t\t Last Write Time: %08lX-%08lX\n", pStatusInfo->LastWriteTime.HighPart, pStatusInfo->LastWriteTime.LowPart);
+
+                printf("\t\t Change Time: %08lX-%08lX\n", pStatusInfo->ChangeTime.HighPart, pStatusInfo->ChangeTime.LowPart);
+
+                printf("\t\t File Attributes: %08lX\n", pStatusInfo->FileAttributes);
+
+                printf("\t\t EOF: %08lX-%08lX\n", pStatusInfo->EndOfFile.HighPart, pStatusInfo->EndOfFile.LowPart);
+
+                printf("\t\t Alloc Size: %08lX-%08lX\n", pStatusInfo->AllocationSize.HighPart, pStatusInfo->AllocationSize.LowPart);
+
+                printf("\t\t EA Size: %08lX\n", pStatusInfo->EaSize);
+
+                printf("\t\t Links: %08lX\n", pStatusInfo->Links);
+            }
+        }
+
+        free( pBuffer);
+    }
+
+    CloseHandle( hControlDevice);
+
+       return 0;
+}
+
+bool
+ParseFID( char *FidName,
+          AFSFileID *FID)
+{
+
+    char *pchCell = NULL, *pchVolume = NULL, *pchVnode = NULL, *pchUnique = NULL;
+    char *pchCurrentPos = FidName;
+    char *pLocation = NULL;
+    char chBuffer[ 50];
+
+    pchCell = pchCurrentPos;
+
+    pLocation = strchr( pchCell, '.');
+
+    if( pLocation == NULL)
+    {
+        return false;
+    }
+
+    pLocation++;
+
+    if( *pLocation == NULL)
+    {
+        return false;
+    }
+
+    pLocation--;
+
+    *pLocation = NULL;
+
+    pLocation++;
+
+    pchVolume = pLocation;
+
+    pLocation = strchr( pchVolume, '.');
+
+    if( pLocation == NULL)
+    {
+        return false;
+    }
+
+    pLocation++;
+
+    if( *pLocation == NULL)
+    {
+        return false;
+    }
+
+    pLocation--;
+
+    *pLocation = NULL;
+
+    pLocation++;
+
+    pchVnode = pLocation;
+
+    pLocation = strchr( pchVnode, '.');
+
+    if( pLocation == NULL)
+    {
+        return false;
+    }
+
+    pLocation++;
+
+    if( *pLocation == NULL)
+    {
+        return false;
+    }
+
+    pLocation--;
+
+    *pLocation = NULL;
+
+    pLocation++;
+
+    pchUnique = pLocation;
+
+    strcpy_s( chBuffer,
+              50,
+              "0x");
+
+    strcat_s( &chBuffer[ 2],
+              48,
+              pchCell);
+
+    if( !StrToIntEx( chBuffer,
+                     STIF_SUPPORT_HEX,
+                     (int *)&FID->Cell))
+    {
+
+        printf("AFSObjectStatus Failed to parse cell %s\n", chBuffer);
+
+        return false;
+    }
+
+    strcpy_s( chBuffer,
+              50,
+              "0x");
+
+    strcat_s( &chBuffer[ 2],
+              48,
+              pchVolume);
+
+    if( !StrToIntEx( chBuffer,
+                     STIF_SUPPORT_HEX,
+                     (int *)&FID->Volume))
+    {
+
+        printf("AFSObjectStatus Failed to parse volume %s\n", chBuffer);
+
+        return false;
+    }
+
+    strcpy_s( chBuffer,
+              50,
+              "0x");
+
+    strcat_s( &chBuffer[ 2],
+              48,
+              pchVnode);
+
+    if( !StrToIntEx( chBuffer,
+                     STIF_SUPPORT_HEX,
+                     (int *)&FID->Vnode))
+    {
+
+        printf("AFSObjectStatus Failed to parse vnode %s\n", chBuffer);
+
+        return false;
+    }
+
+    strcpy_s( chBuffer,
+              50,
+              "0x");
+
+    strcat_s( &chBuffer[ 2],
+              48,
+              pchUnique);
+
+    if( !StrToIntEx( chBuffer,
+                     STIF_SUPPORT_HEX,
+                     (int *)&FID->Unique))
+    {
+
+        printf("AFSObjectStatus Failed to parse Unique %s\n", chBuffer);
+
+        return false;
+    }
+
+    return true;
+}
+
+char *
+GetAFSFileType( IN DWORD FileType)
+{
+
+    char *pchType = NULL;
+
+    switch( FileType)
+    {
+
+        case AFS_FILE_TYPE_FILE:
+        {
+            pchType = "File";
+            break;
+        }
+
+        case AFS_FILE_TYPE_DIRECTORY:
+        {
+            pchType = "Directory";
+            break;
+        }
+
+        case AFS_FILE_TYPE_SYMLINK:
+        {
+            pchType = "Symbolic link";
+            break;
+        }
+
+        case AFS_FILE_TYPE_MOUNTPOINT:
+        {
+            pchType = "Mount point";
+            break;
+        }
+
+        case AFS_FILE_TYPE_DFSLINK:
+        {
+            pchType = "DFS link";
+            break;
+        }
+
+        default:
+        {
+            pchType = "Unknown";
+
+            break;
+        }
+    }
+
+    return pchType;
+}
diff --git a/src/WINNT/afsrdr/tools/objstatus/objstatus.rc b/src/WINNT/afsrdr/tools/objstatus/objstatus.rc
new file mode 100644 (file)
index 0000000..b174e34
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Define VERSIONINFO resource */
+
+#define  AFS_VERINFO_FILE_DESCRIPTION "AFS Redirector Object Status"
+#define AFS_VERINFO_NAME "ObjStatus"
+#define AFS_VERINFO_FILENAME "objstatus.exe"
+
+#include "..\..\AFS_component_version_number.h"
+#include "..\..\..\..\config\NTVersioninfo.rc"
diff --git a/src/WINNT/afsrdr/tools/settrace/NTMakefile b/src/WINNT/afsrdr/tools/settrace/NTMakefile
new file mode 100644 (file)
index 0000000..13d5be3
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright 2004, OpenAFS.ORG and others.
+# All Rights Reserved.
+#
+# This software has been released under the terms of the IBM Public
+# License.  For details, see the LICENSE file in the top-level source
+# directory or online at http://www.openafs.org/dl/license10.html
+
+# include the primary makefile
+RELDIR=WINNT\afsrdr\tools\settrace
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+############################################################################
+#
+# BUILD TARSETS
+#
+
+SETTRACE = ..\..\build\$(CPU)\settrace.exe
+
+SETTRACEOBJS = \
+       $(OUT)\settrace.obj
+
+$(SETTRACEOBJS): $$(@B).cpp
+       $(C2OBJ)  -I..\..\common $**
+
+############################################################################
+
+$(SETTRACE) : $(SETTRACEOBJS) $(OUT)\settrace.res
+       $(EXECONLINK) $(LINKOPTS) shlwapi.lib
+        $(_VC_MANIFEST_EMBED_EXE)
+       $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install : $(SETTRACE)
+
+############################################################################
+#
+# Dependencies
+#
+
+$(OUT)\settrace.res : settrace.rc AFS_component_version_number.h
diff --git a/src/WINNT/afsrdr/tools/settrace/settrace.cpp b/src/WINNT/afsrdr/tools/settrace/settrace.cpp
new file mode 100644 (file)
index 0000000..2449ed2
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <shlwapi.h>
+#include <devioctl.h>
+
+#include "AFSUserDefines.h"
+#include "AFSUserIoctl.h"
+#include "AFSUserStructs.h"
+
+void
+usage( void)
+{
+
+    printf("SetTrace /l <Logging level> | /s <Subsystem> | /b <Buffer size in KB> | /f <debug Flags>\n");
+}
+
+int main(int argc, char* argv[])
+{
+
+    ULONG rc = 0;
+    DWORD bytesReturned = 0;
+    HANDLE hControlDevice = NULL;
+    DWORD dwError = 0;
+    AFSTraceConfigCB stConfig;
+    int dwLevel = -1, dwSystem = -1, dwBufferLen = -1, dwFlags = -1;
+    int dwIndex;
+
+    if( argc < 3)
+    {
+
+        usage();
+
+        return 1;
+    }
+
+    hControlDevice = CreateFile( AFS_SYMLINK,
+                                 GENERIC_READ | GENERIC_WRITE,
+                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                 NULL,
+                                 OPEN_EXISTING,
+                                 0,
+                                 NULL );
+
+    if( hControlDevice == INVALID_HANDLE_VALUE)
+    {
+
+        printf( "SetTrace: Failed to open control device error: %d\n", GetLastError());
+
+        return 2;
+    }
+
+    dwIndex = 1;
+
+    while( dwIndex < argc)
+    {
+
+        if( _strcmpi(argv[ dwIndex], "/l") == 0)
+        {
+
+            if ( !StrToIntExA( argv[ ++dwIndex], STIF_SUPPORT_HEX, &dwLevel))
+            {
+                printf("SetTrace Failed to parse parameter %s\n", argv[ dwIndex]);
+
+                dwError = 1;
+
+                break;
+            }
+        }
+        else if( _strcmpi(argv[ dwIndex], "/s") == 0)
+        {
+
+            if ( !StrToIntExA( argv[ ++dwIndex], STIF_SUPPORT_HEX, &dwSystem))
+            {
+                printf("SetTrace Failed to parse parameter %s\n", argv[ dwIndex]);
+
+                dwError = 1;
+
+                break;
+            }
+        }
+        else if( _strcmpi(argv[ dwIndex], "/b") == 0)
+        {
+
+            if ( !StrToIntExA( argv[ ++dwIndex], STIF_SUPPORT_HEX, &dwBufferLen))
+            {
+                printf("SetTrace Failed to parse parameter %s\n", argv[ dwIndex]);
+
+                dwError = 1;
+
+                break;
+            }
+        }
+        else if( _strcmpi(argv[ dwIndex], "/d") == 0 ||
+                 _strcmpi(argv[ dwIndex], "/f") == 0)
+        {
+
+            if ( !StrToIntExA( argv[ ++dwIndex], STIF_SUPPORT_HEX, &dwFlags))
+            {
+                printf("SetTrace Failed to parse parameter %s\n", argv[ dwIndex]);
+
+                dwError = 1;
+
+                break;
+            }
+        }
+        else
+        {
+
+            usage();
+
+            dwError = 1;
+
+            break;
+        }
+
+        dwIndex++;
+    }
+
+    if ( dwError)
+    {
+
+        rc = 4;
+
+        goto cleanup;
+    }
+
+    stConfig.Subsystem = dwSystem;
+
+    stConfig.TraceLevel = dwLevel;
+
+    stConfig.TraceBufferLength = dwBufferLen;
+
+    stConfig.DebugFlags = dwFlags;
+
+    dwError = DeviceIoControl( hControlDevice,
+                               IOCTL_AFS_CONFIGURE_DEBUG_TRACE,
+                               &stConfig,
+                               sizeof( AFSTraceConfigCB),
+                               NULL,
+                               0,
+                               &bytesReturned,
+                               NULL);
+
+    if( !dwError)
+    {
+
+        printf( "SetTrace Failed to set attributes %d\n", GetLastError());
+
+        rc = 3;
+    }
+    else
+    {
+
+        printf( "SetTrace: Successfully set parameters\n");
+    }
+
+  cleanup:
+
+    CloseHandle( hControlDevice);
+
+    return rc;
+}
+
diff --git a/src/WINNT/afsrdr/tools/settrace/settrace.rc b/src/WINNT/afsrdr/tools/settrace/settrace.rc
new file mode 100644 (file)
index 0000000..136faeb
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice,
+ *   this list of conditions and the following disclaimer in the
+ *   documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
+ *   nor the names of their contributors may be used to endorse or promote
+ *   products derived from this software without specific prior written
+ *   permission from Kernel Drivers, LLC and Your File System, Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Define VERSIONINFO resource */
+
+#define  AFS_VERINFO_FILE_DESCRIPTION "AFS Redirector SetTrace"
+#define AFS_VERINFO_NAME "SetTrace"
+#define AFS_VERINFO_FILENAME "settrace.exe"
+
+#include "..\..\AFS_component_version_number.h"
+#include "..\..\..\..\config\NTVersioninfo.rc"