00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "includes.h"
00023
00024 #undef DBGC_CLASS
00025 #define DBGC_CLASS DBGC_RPC_SRV
00026
00027
00028
00029
00030 static char* get_device_path( const char *device )
00031 {
00032 static pstring path;
00033
00034 pstr_sprintf( path, "ROOT\\Legacy_%s\\0000", device );
00035
00036 return path;
00037 }
00038
00039
00040
00041
00042 WERROR _ntsvcs_get_version( pipes_struct *p, NTSVCS_Q_GET_VERSION *q_u, NTSVCS_R_GET_VERSION *r_u )
00043 {
00044 r_u->version = 0x00000400;
00045
00046 return WERR_OK;
00047 }
00048
00049
00050
00051
00052 WERROR _ntsvcs_get_device_list_size( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST_SIZE *q_u, NTSVCS_R_GET_DEVICE_LIST_SIZE *r_u )
00053 {
00054 fstring device;
00055 const char *devicepath;
00056
00057 if ( !q_u->devicename )
00058 return WERR_ACCESS_DENIED;
00059
00060 rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
00061 devicepath = get_device_path( device );
00062
00063 r_u->size = strlen(devicepath) + 2;
00064
00065 return WERR_OK;
00066 }
00067
00068
00069
00070
00071
00072 WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u )
00073 {
00074 fstring device;
00075 const char *devicepath;
00076
00077 if ( !q_u->devicename )
00078 return WERR_ACCESS_DENIED;
00079
00080 rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
00081 devicepath = get_device_path( device );
00082
00083
00084
00085 init_unistr2( &r_u->devicepath, devicepath, UNI_STR_DBLTERMINATE );
00086 r_u->needed = r_u->devicepath.uni_str_len;
00087
00088 return WERR_OK;
00089 }
00090
00091
00092
00093
00094 WERROR _ntsvcs_get_device_reg_property( pipes_struct *p, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u )
00095 {
00096 fstring devicepath;
00097 char *ptr;
00098 REGVAL_CTR *values;
00099 REGISTRY_VALUE *val;
00100
00101 rpcstr_pull(devicepath, q_u->devicepath.buffer, sizeof(devicepath), q_u->devicepath.uni_str_len*2, 0);
00102
00103 switch( q_u->property ) {
00104 case DEV_REGPROP_DESC:
00105
00106
00107 if ( !(ptr = strrchr_m( devicepath, '\\' )) )
00108 return WERR_GENERAL_FAILURE;
00109 *ptr = '\0';
00110
00111 if ( !(ptr = strrchr_m( devicepath, '_' )) )
00112 return WERR_GENERAL_FAILURE;
00113 ptr++;
00114
00115 if ( !(values = svcctl_fetch_regvalues( ptr, p->pipe_user.nt_user_token )) )
00116 return WERR_GENERAL_FAILURE;
00117
00118 if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) ) {
00119 TALLOC_FREE( values );
00120 return WERR_GENERAL_FAILURE;
00121 }
00122
00123 r_u->unknown1 = 0x1;
00124 r_u->size = reg_init_regval_buffer( &r_u->value, val );
00125 r_u->needed = r_u->size;
00126
00127 TALLOC_FREE(values);
00128
00129 break;
00130
00131 default:
00132 r_u->unknown1 = 0x00437c98;
00133 return WERR_CM_NO_SUCH_VALUE;
00134 }
00135
00136 return WERR_OK;
00137 }
00138
00139
00140
00141
00142 WERROR _ntsvcs_validate_device_instance( pipes_struct *p, NTSVCS_Q_VALIDATE_DEVICE_INSTANCE *q_u, NTSVCS_R_VALIDATE_DEVICE_INSTANCE *r_u )
00143 {
00144
00145 return WERR_OK;
00146 }
00147
00148
00149
00150
00151 WERROR _ntsvcs_get_hw_profile_info( pipes_struct *p, NTSVCS_Q_GET_HW_PROFILE_INFO *q_u, NTSVCS_R_GET_HW_PROFILE_INFO *r_u )
00152 {
00153
00154
00155 r_u->buffer_size = q_u->buffer_size;
00156 r_u->buffer = q_u->buffer;
00157
00158
00159
00160 return WERR_CM_NO_MORE_HW_PROFILES;
00161 }
00162
00163
00164
00165
00166 WERROR _ntsvcs_hw_profile_flags( pipes_struct *p, NTSVCS_Q_HW_PROFILE_FLAGS *q_u, NTSVCS_R_HW_PROFILE_FLAGS *r_u )
00167 {
00168
00169
00170 return WERR_OK;
00171 }
00172