/*++ Copyright (c) 1996 Microsoft Corporation Module Name: tcontrol.c Abstract: Test for cluster resource and resource type controls Author: Rod Gamache (rodga) 30-Dec-1996 Revision History: --*/ #include "windows.h" #include "cluster.h" #include "stdio.h" #include "stdlib.h" #include "resapi.h" LPWSTR ClusterName=NULL; LPWSTR ResourceName=NULL; LPWSTR NodeName=NULL; DWORD ControlCode=0xffffffff; DWORD Access=CLUS_ACCESS_READ; CHAR UsageText[] = "TSET [-c cluster] -n node -r resource -a access ControlCode\n" " cluster\tspecifies the name of the cluster to connect to\n" " node\tspecifies the node to direct the request to\n" " resource\tspecifies the name of the resource to control\n" " access\tspecifies the access to the resource (read, write or any)\n" " ControlCode\ta number between 1 and 9\n"; typedef struct _PROPERTY_MSG1 { DWORD ItemCount; DWORD Syntax1; DWORD ParameterName1ByteCount; WCHAR ParameterName1[20]; DWORD Syntax2; // Dword Data Item to follow DWORD Data; // New value DWORD Syntax3; DWORD ParameterName2ByteCount; WCHAR ParameterName2[12]; DWORD Syntax4; // SZ string to follow DWORD ParameterName3ByteCount; WCHAR ParameterName3[8]; DWORD End; } PROPERTY_MSG1, PPROPERTY_MSG1; typedef struct _PROPERTY_MSG2 { DWORD ItemCount; DWORD Syntax1; DWORD ParameterName1ByteCount; WCHAR ParameterName1[7]; DWORD Syntax2; // Dword Data Item to follow DWORD Data; // New value DWORD End; } PROPERTY_MSG2, PPROPERTY_MSG2; PROPERTY_MSG1 PropertyMsg = { 3, 0x40003, 40, L"IsAlivePollInterval", 0x10002, 0x2000, 0x40003, 24, L"Description", 0x10003, 16, L"Testing", 0 }; PROPERTY_MSG2 PropertyMsg2 = { 1, 0x40003, 16, L"Foobar", 0x10002, 0x200, 0 }; void Usage( void ) { fprintf(stderr, UsageText); exit(1); } LPWSTR GetString( IN LPSTR String ) { LPWSTR wString; DWORD Length; Length = strlen(String)+1; wString = malloc(Length*sizeof(WCHAR)); if (wString == NULL) { fprintf(stderr, "GetString couldn't malloc %d bytes\n",Length*sizeof(WCHAR)); } mbstowcs(wString, String, Length); return(wString); } void ParseArgs( int argc, char *argv[] ) { int i; DWORD IntCount; DWORD Value; CHAR TestValue[16]; PUCHAR ControlData; LPWSTR access; for (i=1;i 16 ) j = 16; ZeroMemory(PrintBuffer, 18); MoveMemory(PrintBuffer, Data, j); for ( i = 0; i < 4; i++ ) { if ( !ReturnSize ) fprintf(stdout, " "); else { fprintf(stdout, " %08lx", PrintData[i]); ReturnSize -= 4; } } fprintf(stdout, " "); for ( i = 0; i < 16; i++ ) { if ( j ) { fprintf(stdout, "%c", isprint(PrintBuffer[i])?PrintBuffer[i]:'.'); j--; } } Data += 4; fprintf(stdout, "\n"); } } return(0); }