您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ win_errstr函数代码示例

51自学网 2021-06-03 09:57:21
  C++
这篇教程C++ win_errstr函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中win_errstr函数的典型用法代码示例。如果您正苦于以下问题:C++ win_errstr函数的具体用法?C++ win_errstr怎么用?C++ win_errstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了win_errstr函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_get_includes

static bool test_get_includes(struct smbconf_ctx *ctx){	WERROR werr;	bool ret = false;	uint32_t num_includes = 0;	char **includes = NULL;	TALLOC_CTX *mem_ctx = talloc_stackframe();	printf("TEST: get_includes/n");	werr = smbconf_get_global_includes(ctx, mem_ctx,					   &num_includes, &includes);	if (!W_ERROR_IS_OK(werr)) {		printf("FAIL: get_includes - %s/n", win_errstr(werr));		goto done;	}	printf("got %u includes%s/n", num_includes,	       (num_includes > 0) ? ":" : ".");	print_strings("", num_includes, (const char **)includes);	printf("OK: get_includes/n");	ret = true;done:	talloc_free(mem_ctx);	return ret;}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:27,


示例2: torture_smbconf_reg

static bool torture_smbconf_reg(void){	WERROR werr;	bool ret = true;	struct smbconf_ctx *conf_ctx = NULL;	TALLOC_CTX *mem_ctx = talloc_stackframe();	printf("test: registry backend/n");	printf("TEST: init/n");	werr = smbconf_init_reg(mem_ctx, &conf_ctx, NULL);	if (!W_ERROR_IS_OK(werr)) {		printf("FAIL: init failed: %s/n", win_errstr(werr));		ret = false;		goto done;	}	printf("OK: init/n");	ret &= test_get_includes(conf_ctx);	ret &= test_set_get_includes(conf_ctx);	ret &= test_delete_includes(conf_ctx);	smbconf_shutdown(conf_ctx);done:	printf("%s: registry backend/n", ret ? "success" : "failure");	talloc_free(mem_ctx);	return ret;}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:29,


示例3: switch

static struct registry_context *open_backend(poptContext pc,					     struct tevent_context *ev_ctx,					     struct loadparm_context *lp_ctx,					     enum reg_backend backend,					     const char *remote_host){	WERROR error;	struct registry_context *ctx;	switch (backend) {	case REG_UNKNOWN:		poptPrintUsage(pc, stderr, 0);		return NULL;	case REG_LOCAL:		error = reg_open_samba(NULL, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials);		break;	case REG_REMOTE:		error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx,					remote_host, ev_ctx);		break;	case REG_NULL:		error = reg_open_local(NULL, &ctx);		break;	}	if (!W_ERROR_IS_OK(error)) {		fprintf(stderr, "Error: %s/n", win_errstr(error));		return NULL;	}	return ctx;}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:32,


示例4: test_FlushFtTable

static bool test_FlushFtTable(struct dcerpc_pipe *p,			      TALLOC_CTX *mem_ctx,			      const char *host,			      const char *sharename){	NTSTATUS status;	struct dfs_FlushFtTable r;	enum dfs_ManagerVersion version;	printf("Testing FlushFtTable/n");	if (!test_GetManagerVersion(p, mem_ctx, &version)) {		return false;	}	r.in.servername = host;	r.in.rootshare = sharename;	status = dcerpc_dfs_FlushFtTable(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("FlushFtTable failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result)) {		printf("dfs_FlushFtTable failed - %s/n",			win_errstr(r.out.result));		IS_DFS_VERSION_UNSUPPORTED_CALL_W2K3(version, r.out.result);		return false;	}	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:31,


示例5: fstrcpy

const char *cli_errstr(struct cli_state *cli){   	fstring cli_error_message;	char *result;	if (!cli->initialised) {		fstrcpy(cli_error_message, "[Programmer's error] cli_errstr called on unitialized cli_stat struct!/n");		goto done;	}	/* Case #1: RAP error */	if (cli->rap_error) {		strlcpy(cli_error_message, win_errstr(W_ERROR(cli->rap_error)),			sizeof(cli_error_message));		goto done;	}	if (!cli_state_is_connected(cli) && NT_STATUS_IS_OK(cli->raw_status)) {		return nt_errstr(NT_STATUS_CONNECTION_DISCONNECTED);	}	return nt_errstr(cli->raw_status); done:	result = talloc_strdup(talloc_tos(), cli_error_message);	SMB_ASSERT(result);	return result;}
开发者ID:AIdrifter,项目名称:samba,代码行数:27,


示例6: test_AddStdRootForced

static bool test_AddStdRootForced(struct dcerpc_pipe *p,				  TALLOC_CTX *mem_ctx,				  const char *host,				  const char *sharename){	NTSTATUS status;	struct dfs_AddStdRootForced r;	enum dfs_ManagerVersion version;	printf("Testing AddStdRootForced/n");	if (!test_GetManagerVersion(p, mem_ctx, &version)) {		return false;	}	r.in.servername	= host;	r.in.rootshare	= sharename;	r.in.comment	= "standard dfs forced standalone DFS root created by smbtorture (dfs_AddStdRootForced)";	r.in.store	= SMBTORTURE_DFS_PATHNAME;	status = dcerpc_dfs_AddStdRootForced(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("AddStdRootForced failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result)) {		printf("dfs_AddStdRootForced failed - %s/n",			win_errstr(r.out.result));		IS_DFS_VERSION_UNSUPPORTED_CALL_W2K3(version, r.out.result);		return false;	}	return test_RemoveStdRoot(p, mem_ctx, host, sharename);}
开发者ID:AllardJ,项目名称:Tomato,代码行数:33,


示例7: test_RemoveStdRoot

static bool test_RemoveStdRoot(struct dcerpc_pipe *p,			       TALLOC_CTX *mem_ctx,			       const char *host,			       const char *sharename){	struct dfs_RemoveStdRoot r;	NTSTATUS status;	printf("Testing RemoveStdRoot/n");	r.in.servername	= host;	r.in.rootshare	= sharename;	r.in.flags	= 0;	status = dcerpc_dfs_RemoveStdRoot(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("RemoveStdRoot failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result)) {		printf("dfs_RemoveStdRoot failed - %s/n",			win_errstr(r.out.result));		return false;	}	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:26,


示例8: cmd_clusapi_get_cluster_name

static WERROR cmd_clusapi_get_cluster_name(struct rpc_pipe_client *cli,					   TALLOC_CTX *mem_ctx,					   int argc,					   const char **argv){	struct dcerpc_binding_handle *b = cli->binding_handle;	NTSTATUS status;	WERROR error;	const char *ClusterName;	const char *NodeName;	status = dcerpc_clusapi_GetClusterName(b, mem_ctx,					       &ClusterName,					       &NodeName,					       &error);	if (!NT_STATUS_IS_OK(status)) {		return ntstatus_to_werror(status);	}	if (!W_ERROR_IS_OK(error)) {		printf("error: %s/n", win_errstr(error));		return error;	}	printf("ClusterName: %s/n", ClusterName);	printf("NodeName: %s/n", NodeName);	return WERR_OK;}
开发者ID:jkstrick,项目名称:samba,代码行数:29,


示例9: smbconf_reg_create_service_key

/** * create a subkey of the base key (i.e. a service...) */static sbcErr smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,					     struct smbconf_ctx *ctx,					     const char * subkeyname,					     struct registry_key **newkey){	WERROR werr;	sbcErr err = SBC_ERR_OK;	TALLOC_CTX *create_ctx;	enum winreg_CreateAction action = REG_ACTION_NONE;	/* create a new talloc ctx for creation. it will hold	 * the intermediate parent key (SMBCONF) for creation	 * and will be destroyed when leaving this function... */	create_ctx = talloc_stackframe();	werr = reg_createkey(mem_ctx, rpd(ctx)->base_key, subkeyname,			     REG_KEY_WRITE, newkey, &action);	if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {		DEBUG(10, ("Key '%s' already exists./n", subkeyname));		err = SBC_ERR_FILE_EXISTS;	}	if (!W_ERROR_IS_OK(werr)) {		DEBUG(5, ("Error creating key %s: %s/n",			 subkeyname, win_errstr(werr)));		err = SBC_ERR_UNKNOWN_FAILURE;	}	talloc_free(create_ctx);	return err;}
开发者ID:andrew-aladev,项目名称:samba-talloc-debug,代码行数:33,


示例10: test_GetDcAddress

static bool test_GetDcAddress(struct dcerpc_pipe *p,			      TALLOC_CTX *mem_ctx,			      const char *host){	NTSTATUS status;	struct dfs_GetDcAddress r;	uint8_t is_root = 0;	uint32_t ttl = 0;	const char *ptr;	printf("Testing GetDcAddress/n");	ptr = host;	r.in.servername = host;	r.in.server_fullname = r.out.server_fullname = &ptr;	r.in.is_root = r.out.is_root = &is_root;	r.in.ttl = r.out.ttl = &ttl;	status = dcerpc_dfs_GetDcAddress(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("GetDcAddress failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result)) {		printf("dfs_GetDcAddress failed - %s/n",			win_errstr(r.out.result));		return false;	}	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:31,


示例11: net_registry_enumerate_recursive

static int net_registry_enumerate_recursive(struct net_context *c, int argc,					    const char **argv){	WERROR werr;	struct registry_key *key = NULL;	char* name = NULL;	TALLOC_CTX *ctx = talloc_stackframe();	int ret = -1;	if (argc != 1 || c->display_usage) {		d_printf("%s/n%s",			 _("Usage:"),			 _("net registry enumerate <path>/n"));		d_printf("%s/n%s",			 _("Example:"),			 _("net registry enumerate 'HKLM//Software//Samba'/n"));		goto done;	}	werr = open_hive(ctx, argv[0], REG_KEY_READ, &key, &name);	if (!W_ERROR_IS_OK(werr)) {		d_fprintf(stderr, _("open_key failed: %s/n"), win_errstr(werr));		goto done;	}	werr = registry_enumkey(key, name, true);	if (W_ERROR_IS_OK(werr)) {		ret = 0;	}done:	TALLOC_FREE(ctx);	return ret;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:33,


示例12: test_SetDcAddress

static bool test_SetDcAddress(struct dcerpc_pipe *p,			      TALLOC_CTX *mem_ctx,			      const char *host){	NTSTATUS status;	struct dfs_SetDcAddress r;	printf("Testing SetDcAddress/n");	r.in.servername = host;	r.in.server_fullname = host;	r.in.flags = 0;	r.in.ttl = 1000;	status = dcerpc_dfs_SetDcAddress(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("SetDcAddress failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result)) {		printf("dfs_SetDcAddress failed - %s/n",			win_errstr(r.out.result));		return false;	}	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:26,


示例13: test_AddStdRoot

static bool test_AddStdRoot(struct dcerpc_pipe *p,			    TALLOC_CTX *mem_ctx,			    const char *host,			    const char *sharename){	NTSTATUS status;	struct dfs_AddStdRoot r;	printf("Testing AddStdRoot/n");	r.in.servername	= host;	r.in.rootshare	= sharename;	r.in.comment	= "standard dfs standalone DFS root created by smbtorture (dfs_AddStdRoot)";	r.in.flags	= 0;	status = dcerpc_dfs_AddStdRoot(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("AddStdRoot failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result)) {		printf("dfs_AddStdRoot failed - %s/n",			win_errstr(r.out.result));		return false;	}	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:27,


示例14: smbconf_reg_delete_values

/** * delete all values from a key */static sbcErr smbconf_reg_delete_values(struct registry_key *key){	WERROR werr;	sbcErr err;	char *valname;	struct registry_value *valvalue;	uint32_t count;	TALLOC_CTX *mem_ctx = talloc_stackframe();	for (count = 0;	     werr = reg_enumvalue(mem_ctx, key, count, &valname, &valvalue),	     W_ERROR_IS_OK(werr);	     count++)	{		werr = reg_deletevalue(key, valname);		if (!W_ERROR_IS_OK(werr)) {			err = SBC_ERR_ACCESS_DENIED;			goto done;		}	}	if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {		DEBUG(1, ("smbconf_reg_delete_values: "			  "Error enumerating values of %s: %s/n",			  key->key->name,			  win_errstr(werr)));		err = SBC_ERR_ACCESS_DENIED;		goto done;	}	err = SBC_ERR_OK;done:	talloc_free(mem_ctx);	return err;}
开发者ID:andrew-aladev,项目名称:samba-talloc-debug,代码行数:38,


示例15: test_GetInfoLevel

static bool test_GetInfoLevel(struct dcerpc_pipe *p,			      TALLOC_CTX *mem_ctx,			      uint16_t level,			      const char *root){	NTSTATUS status;	struct dfs_GetInfo r;	union dfs_Info info;	printf("Testing GetInfo level %u on '%s'/n", level, root);	r.in.dfs_entry_path = talloc_strdup(mem_ctx, root);	r.in.servername = NULL;	r.in.sharename = NULL;	r.in.level = level;	r.out.info = &info;	status = dcerpc_dfs_GetInfo(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("GetInfo failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result) &&		   !W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, r.out.result)) {		printf("dfs_GetInfo failed - %s/n", win_errstr(r.out.result));		return false;	}	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:29,


示例16: test_DsRoleGetPrimaryDomainInformation

BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx){	struct dssetup_DsRoleGetPrimaryDomainInformation r;	NTSTATUS status;	BOOL ret = True;	int i;	printf("/ntesting DsRoleGetPrimaryDomainInformation/n");	for (i=DS_ROLE_BASIC_INFORMATION; i <= DS_ROLE_OP_STATUS; i++) {		r.in.level = i;		status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, mem_ctx, &r);		if (!NT_STATUS_IS_OK(status)) {			const char *errstr = nt_errstr(status);			if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {				errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);			}			printf("dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d failed - %s/n",				i, errstr);			ret = False;		} else if (!W_ERROR_IS_OK(r.out.result)) {			printf("DsRoleGetPrimaryDomainInformation level %d failed - %s/n",				i, win_errstr(r.out.result));			ret = False;		}	}	return ret;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:30,


示例17: test_ManagerInitialize

static bool test_ManagerInitialize(struct dcerpc_pipe *p,				   TALLOC_CTX *mem_ctx,				   const char *host){	NTSTATUS status;	enum dfs_ManagerVersion version;	struct dfs_ManagerInitialize r;	printf("Testing ManagerInitialize/n");	if (!test_GetManagerVersion(p, mem_ctx, &version)) {		return false;	}	r.in.servername = host;	r.in.flags = 0;	status = dcerpc_dfs_ManagerInitialize(p, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("ManagerInitialize failed - %s/n", nt_errstr(status));		return false;	} else if (!W_ERROR_IS_OK(r.out.result)) {		printf("dfs_ManagerInitialize failed - %s/n",			win_errstr(r.out.result));		IS_DFS_VERSION_UNSUPPORTED_CALL_W2K3(version, r.out.result);		return false;	}	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:30,


示例18: main

int main(int argc, char **argv){	int opt;	poptContext pc;	char *outputfile = NULL;	struct registry_context *h1 = NULL, *h2 = NULL;	int from_null = 0;	WERROR error;	struct reg_diff *diff;	struct poptOption long_options[] = {		POPT_AUTOHELP		{"output", 'o', POPT_ARG_STRING, &outputfile, 'o', "output file to use", NULL },		{"null", 'n', POPT_ARG_NONE, &from_null, 'n', "Diff from NULL", NULL },		{"remote", 'R', POPT_ARG_STRING, NULL, 0, "Connect to remote server" , NULL },		{"local", 'L', POPT_ARG_NONE, NULL, 0, "Open local registry", NULL },		POPT_COMMON_SAMBA		POPT_COMMON_CREDENTIALS		POPT_COMMON_VERSION		{ NULL }	};	registry_init();	pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0);	while((opt = poptGetNextOpt(pc)) != -1) {		error = WERR_OK;		switch(opt)	{		case 'L':			if (!h1 && !from_null) error = reg_open_local(NULL, &h1, NULL, cmdline_credentials);			else if (!h2) error = reg_open_local(NULL, &h2, NULL, cmdline_credentials);			break;		case 'R':			if (!h1 && !from_null) 				error = reg_open_remote(&h1, NULL, cmdline_credentials, 							poptGetOptArg(pc), NULL);			else if (!h2) error = reg_open_remote(&h2, NULL, cmdline_credentials, 							      poptGetOptArg(pc), NULL);			break;		}		if (!W_ERROR_IS_OK(error)) {			fprintf(stderr, "Error: %s/n", win_errstr(error));			return 1;		}	}	poptFreeContext(pc);	diff = reg_generate_diff(NULL, h1, h2);	if (!diff) {		fprintf(stderr, "Unable to generate diff between keys/n");		return -1;	}	reg_diff_save(diff, outputfile);	return 0;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:59,


示例19: dsdb_repl_make_working_schema

/** * Multi-pass working schema creation * Function will: *  - shallow copy initial schema supplied *  - create a working schema in multiple passes *    until all objects are resolved * Working schema is a schema with Attributes, Classes * and indexes, but w/o subClassOf, possibleSupperiors etc. * It is to be used just us cache for converting attribute values. */WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,				     const struct dsdb_schema *initial_schema,				     const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr,				     uint32_t object_count,				     const struct drsuapi_DsReplicaObjectListItemEx *first_object,				     const DATA_BLOB *gensec_skey,				     TALLOC_CTX *mem_ctx,				     struct dsdb_schema **_schema_out){	WERROR werr;	struct dsdb_schema_prefixmap *pfm_remote;	struct dsdb_schema *working_schema;	/* make a copy of the iniatial_scheam so we don't mess with it */	working_schema = dsdb_schema_copy_shallow(mem_ctx, ldb, initial_schema);	if (!working_schema) {		DEBUG(0,(__location__ ": schema copy failed!/n"));		return WERR_NOMEM;	}	/* we are going to need remote prefixMap for decoding */	werr = dsdb_schema_pfm_from_drsuapi_pfm(mapping_ctr, true,						mem_ctx, &pfm_remote, NULL);	if (!W_ERROR_IS_OK(werr)) {		DEBUG(0,(__location__ ": Failed to decode remote prefixMap: %s",			 win_errstr(werr)));		return werr;	}	werr = dsdb_repl_resolve_working_schema(ldb, mem_ctx,						pfm_remote,						0, /* cycle_before_switching */						working_schema,						working_schema,						object_count,						first_object);	if (!W_ERROR_IS_OK(werr)) {		DEBUG(0, ("%s: dsdb_repl_resolve_working_schema() failed: %s",			  __location__, win_errstr(werr)));		return werr;	}	*_schema_out = working_schema;	return WERR_OK;}
开发者ID:jasonltaylor,项目名称:samba,代码行数:56,


示例20: talloc_stackframe

const char *svcctl_get_string_value(TALLOC_CTX *mem_ctx,				    struct messaging_context *msg_ctx,				    const struct auth_session_info *session_info,				    const char *key_name,				    const char *value_name){	struct dcerpc_binding_handle *h = NULL;	uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;	struct policy_handle hive_hnd, key_hnd;	const char *data = NULL;	char *path = NULL;	TALLOC_CTX *tmp_ctx;	NTSTATUS status;	WERROR result = WERR_OK;	tmp_ctx = talloc_stackframe();	if (tmp_ctx == NULL) {		return NULL;	}	path = talloc_asprintf(tmp_ctx, "%s//%s",					TOP_LEVEL_SERVICES_KEY, key_name);	if (path == NULL) {		goto done;	}	status = dcerpc_winreg_int_hklm_openkey(tmp_ctx,						session_info,						msg_ctx,						&h,						path,						false,						access_mask,						&hive_hnd,						&key_hnd,						&result);	if (!NT_STATUS_IS_OK(status)) {		DEBUG(2, ("svcctl_get_string_value: Could not open %s - %s/n",			  path, nt_errstr(status)));		goto done;	}	if (!W_ERROR_IS_OK(result)) {		DEBUG(2, ("svcctl_get_string_value: Could not open %s - %s/n",			  path, win_errstr(result)));		goto done;	}	status = dcerpc_winreg_query_sz(mem_ctx,					h,					&key_hnd,					value_name,					&data,					&result);done:	talloc_free(tmp_ctx);	return data;}
开发者ID:encukou,项目名称:samba,代码行数:58,


示例21: smbconf_reg_set_multi_sz_value

static sbcErr smbconf_reg_set_multi_sz_value(struct registry_key *key,					     const char *valname,					     const uint32_t num_strings,					     const char **strings){	WERROR werr;	sbcErr err = SBC_ERR_OK;	struct registry_value *value;	uint32_t count;	TALLOC_CTX *tmp_ctx = talloc_stackframe();	const char **array;	if (strings == NULL) {		err = SBC_ERR_INVALID_PARAM;		goto done;	}	array = talloc_zero_array(tmp_ctx, const char *, num_strings + 1);	if (array == NULL) {		err = SBC_ERR_NOMEM;		goto done;	}	value = talloc_zero(tmp_ctx, struct registry_value);	if (value == NULL) {		err = SBC_ERR_NOMEM;		goto done;	}	value->type = REG_MULTI_SZ;	for (count = 0; count < num_strings; count++) {		array[count] = talloc_strdup(value, strings[count]);		if (array[count] == NULL) {			err = SBC_ERR_NOMEM;			goto done;		}	}	if (!push_reg_multi_sz(value, &value->data, array)) {		err = SBC_ERR_NOMEM;		goto done;	}	werr = reg_setvalue(key, valname, value);	if (!W_ERROR_IS_OK(werr)) {		DEBUG(5, ("Error adding value '%s' to key '%s': %s/n",			  valname, key->key->name, win_errstr(werr)));		err = SBC_ERR_ACCESS_DENIED;	}done:	talloc_free(tmp_ctx);	return err;}
开发者ID:andrew-aladev,项目名称:samba-talloc-debug,代码行数:55,


示例22: main

int main(int argc, const char **argv){	struct poptOption long_options[] = {		POPT_AUTOHELP		/* ... */		POPT_COMMON_SAMBA		POPT_COMMON_CONNECTION		POPT_COMMON_CREDENTIALS		POPT_TABLEEND	};	int opt;	poptContext pc;	struct user_auth_info *auth_info;	TALLOC_CTX *frame;	struct registry_context *ctx;	WERROR rv;	frame = talloc_stackframe();	setup_logging("regedit", DEBUG_DEFAULT_STDERR);	lp_set_cmdline("log level", "0");	/* process options */	auth_info = user_auth_info_init(frame);	if (auth_info == NULL) {		exit(1);	}	popt_common_set_auth_info(auth_info);	pc = poptGetContext("regedit", argc, argv, long_options, 0);	while ((opt = poptGetNextOpt(pc)) != -1) {		/* TODO */	}	if (!lp_load_global(get_dyn_CONFIGFILE())) {		DEBUG(0, ("ERROR loading config file.../n"));		exit(1);	}	rv = reg_open_samba3(frame, &ctx);	if (!W_ERROR_IS_OK(rv)) {		fprintf(stderr, "Unable to open registry: %s/n",			win_errstr(rv));		TALLOC_FREE(frame);		return 1;	}	display_window(frame, ctx);	TALLOC_FREE(frame);	return 0;}
开发者ID:dmitry-shavyrin,项目名称:samba4_embedded_build,代码行数:54,


示例23: net_registry_enumerate

static int net_registry_enumerate(struct net_context *c, int argc,				  const char **argv){	WERROR werr;	struct registry_key *key = NULL;	TALLOC_CTX *ctx = talloc_stackframe();	char *subkey_name;	NTTIME modtime;	uint32_t count;	char *valname = NULL;	struct registry_value *valvalue = NULL;	int ret = -1;	if (argc != 1 || c->display_usage) {		d_printf("Usage:    net registry enumerate <path>/n");		d_printf("Example:  net registry enumerate "			 "'HKLM//Software//Samba'/n");		goto done;	}	werr = open_key(ctx, argv[0], REG_KEY_READ, &key);	if (!W_ERROR_IS_OK(werr)) {		d_fprintf(stderr, "open_key failed: %s/n", win_errstr(werr));		goto done;	}	for (count = 0;	     werr = reg_enumkey(ctx, key, count, &subkey_name, &modtime),	     W_ERROR_IS_OK(werr);	     count++)	{		print_registry_key(subkey_name, &modtime);	}	if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {		goto done;	}	for (count = 0;	     werr = reg_enumvalue(ctx, key, count, &valname, &valvalue),	     W_ERROR_IS_OK(werr);	     count++)	{		print_registry_value_with_name(valname, valvalue);	}	if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {		goto done;	}	ret = 0;done:	TALLOC_FREE(ctx);	return ret;}
开发者ID:gojdic,项目名称:samba,代码行数:53,


示例24: cmd_clusapi_open_cluster

static WERROR cmd_clusapi_open_cluster(struct rpc_pipe_client *cli,				       TALLOC_CTX *mem_ctx,				       int argc,				       const char **argv){	struct dcerpc_binding_handle *b = cli->binding_handle;	NTSTATUS status;	WERROR error;	struct policy_handle Cluster;	status = dcerpc_clusapi_OpenCluster(b, mem_ctx,					    &error,					    &Cluster);	if (!NT_STATUS_IS_OK(status)) {		return ntstatus_to_werror(status);	}	if (!W_ERROR_IS_OK(error)) {		printf("error: %s/n", win_errstr(error));		return error;	}	printf("successfully opened cluster/n");	status = dcerpc_clusapi_CloseCluster(b, mem_ctx,					     &Cluster,					     &error);	if (!NT_STATUS_IS_OK(status)) {		return ntstatus_to_werror(status);	}	if (!W_ERROR_IS_OK(error)) {		printf("error: %s/n", win_errstr(error));		return error;	}	printf("successfully closed cluster/n");	return WERR_OK;}
开发者ID:jkstrick,项目名称:samba,代码行数:40,


示例25: W_ERROR_V

const char *get_friendly_werror_msg(WERROR werror){    int i = 0;    for (i = 0; i < ARRAY_SIZE(dos_err_strs); i++) {        if (W_ERROR_V(dos_err_strs[i].werror) ==                W_ERROR_V(werror)) {            return dos_err_strs[i].friendly_errstr;        }    }    return win_errstr(werror);}
开发者ID:berte,项目名称:mediaplayer,代码行数:13,


示例26: mprWERROR

/*  turn a WERROR into a MprVar object with lots of funky properties*/struct MprVar mprWERROR(WERROR status){	struct MprVar res;	res = mprObject("werror");	mprSetVar(&res, "errstr", mprString(win_errstr(status)));	mprSetVar(&res, "v", mprCreateIntegerVar(W_ERROR_V(status)));	mprSetVar(&res, "is_ok", mprCreateBoolVar(W_ERROR_IS_OK(status)));	mprSetVar(&res, "is_err", mprCreateBoolVar(!W_ERROR_IS_OK(status)));	return res;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:16,


示例27: net_registry_deletekey

static int net_registry_deletekey(struct net_context *c, int argc,				  const char **argv){	WERROR werr;	char *subkeyname;	struct registry_key *hivekey = NULL;	TALLOC_CTX *ctx = talloc_stackframe();	int ret = -1;	if (argc != 1 || c->display_usage) {		d_printf("Usage:    net registry deletekey <path>/n");		d_printf("Example:  net registry deletekey "			 "'HKLM//Software//Samba//smbconf.127.0.0.1'/n");		goto done;	}	if (strlen(argv[0]) == 0) {		d_fprintf(stderr, "error: zero length key name given/n");		goto done;	}	werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);	if (!W_ERROR_IS_OK(werr)) {		d_fprintf(stderr, "open_hive failed: %s/n", win_errstr(werr));		goto done;	}	werr = reg_deletekey(hivekey, subkeyname);	if (!W_ERROR_IS_OK(werr)) {		d_fprintf(stderr, "reg_deletekey failed: %s/n",			  win_errstr(werr));		goto done;	}	ret = 0;done:	TALLOC_FREE(ctx);	return ret;}
开发者ID:gojdic,项目名称:samba,代码行数:39,


示例28: cmd_clusapi_open_resource

static WERROR cmd_clusapi_open_resource(struct rpc_pipe_client *cli,					TALLOC_CTX *mem_ctx,					int argc,					const char **argv){	struct dcerpc_binding_handle *b = cli->binding_handle;	NTSTATUS status;	const char *lpszResourceName = "Cluster Name";	WERROR Status;	struct policy_handle hResource;	WERROR rpc_status, ignore;	if (argc >= 2) {		lpszResourceName = argv[1];	}	status = dcerpc_clusapi_OpenResource(b, mem_ctx,					     lpszResourceName,					     &Status,					     &rpc_status,					     &hResource);	if (!NT_STATUS_IS_OK(status)) {		return ntstatus_to_werror(status);	}	if (!W_ERROR_IS_OK(Status)) {		printf("Status: %s/n", win_errstr(Status));		return Status;	}	printf("rpc_status: %s/n", win_errstr(rpc_status));	dcerpc_clusapi_CloseResource(b, mem_ctx,				     &hResource,				     &ignore);	return WERR_OK;}
开发者ID:jkstrick,项目名称:samba,代码行数:38,



注:本文中的win_errstr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ win_print函数代码示例
C++ win_compopup_set_msg函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。