本文整理汇总了C++中SCVAL函数的典型用法代码示例。如果您正苦于以下问题:C++ SCVAL函数的具体用法?C++ SCVAL怎么用?C++ SCVAL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SCVAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: smb_raw_search_close_old
/****************************************************************************
Old style search next.
****************************************************************************/
static NTSTATUS smb_raw_search_close_old(struct smbcli_tree *tree,
union smb_search_close *io)
{
struct smbcli_request *req;
uint8_t var_block[21];
req = smbcli_request_setup(tree, SMBfclose, 2, 0);
if (!req) {
return NT_STATUS_NO_MEMORY;
}
SSVAL(req->out.vwv, VWV(0), io->fclose.in.max_count);
SSVAL(req->out.vwv, VWV(1), io->fclose.in.search_attrib);
smbcli_req_append_ascii4(req, "", STR_TERMINATE);
SCVAL(var_block, 0, io->fclose.in.id.reserved);
memcpy(&var_block[1], io->fclose.in.id.name, 11);
SCVAL(var_block, 12, io->fclose.in.id.handle);
SIVAL(var_block, 13, io->fclose.in.id.server_cookie);
SIVAL(var_block, 17, io->fclose.in.id.client_cookie);
smbcli_req_append_var_block(req, var_block, 21);
if (!smbcli_request_send(req) ||
!smbcli_request_receive(req)) {
return smbcli_request_destroy(req);
}
return smbcli_request_destroy(req);
}
示例2: smb2_request_init_tree
/*
send a find request
*/
struct smb2_request *smb2_find_send(struct smb2_tree *tree, struct smb2_find *io)
{
struct smb2_request *req;
NTSTATUS status;
req = smb2_request_init_tree(tree, SMB2_OP_QUERY_DIRECTORY, 0x20, true, 0);
if (req == NULL) return NULL;
SCVAL(req->out.body, 0x02, io->in.level);
SCVAL(req->out.body, 0x03, io->in.continue_flags);
SIVAL(req->out.body, 0x04, io->in.file_index);
smb2_push_handle(req->out.body+0x08, &io->in.file.handle);
status = smb2_push_o16s16_string(&req->out, 0x18, io->in.pattern);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(req);
return NULL;
}
SIVAL(req->out.body, 0x1C, io->in.max_response_size);
smb2_transport_send(req);
return req;
}
示例3: smbsrv_send_oplock_break
/*
send an oplock break request to a client
*/
NTSTATUS smbsrv_send_oplock_break(void *p, struct ntvfs_handle *ntvfs, uint8_t level)
{
struct smbsrv_tcon *tcon = talloc_get_type(p, struct smbsrv_tcon);
struct smbsrv_request *req;
req = smbsrv_init_request(tcon->smb_conn);
NT_STATUS_HAVE_NO_MEMORY(req);
smbsrv_setup_reply(req, 8, 0);
SCVAL(req->out.hdr,HDR_COM,SMBlockingX);
SSVAL(req->out.hdr,HDR_TID,tcon->tid);
SSVAL(req->out.hdr,HDR_PID,0xFFFF);
SSVAL(req->out.hdr,HDR_UID,0);
SSVAL(req->out.hdr,HDR_MID,0xFFFF);
SCVAL(req->out.hdr,HDR_FLG,0);
SSVAL(req->out.hdr,HDR_FLG2,0);
SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE);
SSVAL(req->out.vwv, VWV(1), 0);
smbsrv_push_fnum(req->out.vwv, VWV(2), ntvfs);
SCVAL(req->out.vwv, VWV(3), LOCKING_ANDX_OPLOCK_RELEASE);
SCVAL(req->out.vwv, VWV(3)+1, level);
SIVAL(req->out.vwv, VWV(4), 0);
SSVAL(req->out.vwv, VWV(6), 0);
SSVAL(req->out.vwv, VWV(7), 0);
smbsrv_send_reply(req);
return NT_STATUS_OK;
}
示例4: cli_setup_packet_buf
void cli_setup_packet_buf(struct cli_state *cli, char *buf)
{
uint16 flags2;
cli->rap_error = 0;
SIVAL(buf,smb_rcls,0);
SSVAL(buf,smb_pid,cli->pid);
memset(buf+smb_pidhigh, 0, 12);
SSVAL(buf,smb_uid,cli->vuid);
SSVAL(buf,smb_mid,cli->mid);
if (cli->protocol <= PROTOCOL_CORE) {
return;
}
if (cli->case_sensitive) {
SCVAL(buf,smb_flg,0x0);
} else {
/* Default setting, case insensitive. */
SCVAL(buf,smb_flg,0x8);
}
flags2 = FLAGS2_LONG_PATH_COMPONENTS;
if (cli->capabilities & CAP_UNICODE)
flags2 |= FLAGS2_UNICODE_STRINGS;
if ((cli->capabilities & CAP_DFS) && cli->dfsroot)
flags2 |= FLAGS2_DFS_PATHNAMES;
if (cli->capabilities & CAP_STATUS32)
flags2 |= FLAGS2_32_BIT_ERROR_CODES;
if (cli->use_spnego)
flags2 |= FLAGS2_EXTENDED_SECURITY;
SSVAL(buf,smb_flg2, flags2);
}
示例5: cli_negprot_send
void cli_negprot_send(struct cli_state *cli)
{
char *p;
int numprots;
memset(cli->outbuf,'\0',smb_size);
/* setup the protocol strings */
set_message(cli->outbuf,0,0,True);
p = smb_buf(cli->outbuf);
for (numprots=0;
prots[numprots].name && prots[numprots].prot<=cli->protocol;
numprots++) {
*p++ = 2;
p += clistr_push(cli, p, prots[numprots].name, -1, STR_CONVERT|STR_TERMINATE);
}
SCVAL(cli->outbuf,smb_com,SMBnegprot);
cli_setup_bcc(cli, p);
cli_setup_packet(cli);
SCVAL(smb_buf(cli->outbuf),0,2);
cli_send_smb(cli);
}
示例6: send_election_dgram
static void send_election_dgram(struct subnet_record *subrec, const char *workgroup_name,
uint32 criterion, int timeup,const char *server_name)
{
pstring outbuf;
unstring srv_name;
char *p;
DEBUG(2,("send_election_dgram: Sending election packet for workgroup %s on subnet %s\n",
workgroup_name, subrec->subnet_name ));
memset(outbuf,'\0',sizeof(outbuf));
p = outbuf;
SCVAL(p,0,ANN_Election); /* Election opcode. */
p++;
SCVAL(p,0,((criterion == 0 && timeup == 0) ? 0 : ELECTION_VERSION));
SIVAL(p,1,criterion);
SIVAL(p,5,timeup*1000); /* ms - Despite what the spec says. */
p += 13;
unstrcpy(srv_name, server_name);
strupper_m(srv_name);
/* The following call does UNIX -> DOS charset conversion. */
pstrcpy_base(p, srv_name, outbuf);
p = skip_string(p,1);
send_mailslot(False, BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
global_myname(), 0,
workgroup_name, 0x1e,
subrec->bcast_ip, subrec->myip, DGRAM_PORT);
}
示例7: send_announcement
static void send_announcement(struct subnet_record *subrec, int announce_type,
const char *from_name, const char *to_name, int to_type, struct in_addr to_ip,
time_t announce_interval,
const char *server_name, int server_type, const char *server_comment)
{
pstring outbuf;
char *p;
memset(outbuf,'\0',sizeof(outbuf));
p = outbuf+1;
SCVAL(outbuf,0,announce_type);
/* Announcement parameters. */
SCVAL(p,0,updatecount);
SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */
push_string(NULL, p+5, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
SCVAL(p,21,lp_major_announce_version()); /* Major version. */
SCVAL(p,22,lp_minor_announce_version()); /* Minor version. */
SIVAL(p,23,server_type & ~SV_TYPE_LOCAL_LIST_ONLY);
/* Browse version: got from NT/AS 4.00 - Value defined in smb.h (JHT). */
SSVAL(p,27,BROWSER_ELECTION_VERSION);
SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */
p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE);
send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
DGRAM_PORT);
}
示例8: send_election_dgram
static void send_election_dgram(struct subnet_record *subrec, const char *workgroup_name,
uint32_t criterion, int timeup,const char *server_name)
{
char outbuf[1024];
unstring srv_name;
char *p;
DEBUG(2,("send_election_dgram: Sending election packet for workgroup %s on subnet %s\n",
workgroup_name, subrec->subnet_name ));
memset(outbuf,'\0',sizeof(outbuf));
p = outbuf;
SCVAL(p,0,ANN_Election); /* Election opcode. */
p++;
SCVAL(p,0,((criterion == 0 && timeup == 0) ? 0 : ELECTION_VERSION));
SIVAL(p,1,criterion);
SIVAL(p,5,timeup*1000); /* ms - Despite what the spec says. */
p += 13;
unstrcpy(srv_name, server_name);
if (!strupper_m(srv_name)) {
DEBUG(2,("strupper_m failed for %s\n", srv_name));
return;
}
/* The following call does UNIX -> DOS charset conversion. */
push_ascii(p, srv_name, sizeof(outbuf)-PTR_DIFF(p,outbuf)-1, STR_TERMINATE);
p = skip_string(outbuf,sizeof(outbuf),p);
send_mailslot(False, BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
lp_netbios_name(), 0,
workgroup_name, 0x1e,
subrec->bcast_ip, subrec->myip, DGRAM_PORT);
}
示例9: smb2_request_init
/**
send a session setup request
*/
struct smb2_request *smb2_session_setup_send(struct smb2_session *session,
struct smb2_session_setup *io)
{
struct smb2_request *req;
NTSTATUS status;
req = smb2_request_init(session->transport, SMB2_OP_SESSSETUP,
0x18, true, io->in.secblob.length);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_SESSION_ID, session->uid);
SCVAL(req->out.body, 0x02, io->in.vc_number);
SCVAL(req->out.body, 0x03, io->in.security_mode);
SIVAL(req->out.body, 0x04, io->in.capabilities);
SIVAL(req->out.body, 0x08, io->in.channel);
SBVAL(req->out.body, 0x10, io->in.previous_sessionid);
req->session = session;
status = smb2_push_o16s16_blob(&req->out, 0x0C, io->in.secblob);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(req);
return NULL;
}
smb2_transport_send(req);
return req;
}
示例10: smbd_smb2_request_read_done
static void smbd_smb2_request_read_done(struct tevent_req *subreq)
{
struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
struct smbd_smb2_request);
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint8_t out_data_offset;
DATA_BLOB out_data_buffer = data_blob_null;
uint32_t out_data_remaining = 0;
NTSTATUS status;
NTSTATUS error; /* transport error */
status = smbd_smb2_read_recv(subreq,
req,
&out_data_buffer,
&out_data_remaining);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
error = smbd_smb2_request_error(req, status);
if (!NT_STATUS_IS_OK(error)) {
smbd_server_connection_terminate(req->xconn,
nt_errstr(error));
return;
}
return;
}
out_data_offset = SMB2_HDR_BODY + 0x10;
outbody = smbd_smb2_generate_outbody(req, 0x10);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
if (!NT_STATUS_IS_OK(error)) {
smbd_server_connection_terminate(req->xconn,
nt_errstr(error));
return;
}
return;
}
SSVAL(outbody.data, 0x00, 0x10 + 1); /* struct size */
SCVAL(outbody.data, 0x02,
out_data_offset); /* data offset */
SCVAL(outbody.data, 0x03, 0); /* reserved */
SIVAL(outbody.data, 0x04,
out_data_buffer.length); /* data length */
SIVAL(outbody.data, 0x08,
out_data_remaining); /* data remaining */
SIVAL(outbody.data, 0x0C, 0); /* reserved */
outdyn = out_data_buffer;
error = smbd_smb2_request_done(req, outbody, &outdyn);
if (!NT_STATUS_IS_OK(error)) {
smbd_server_connection_terminate(req->xconn,
nt_errstr(error));
return;
}
}
示例11: smb_set_enclen
static void smb_set_enclen(char *buf,int len,uint16_t enc_ctx_num)
{
_smb_setlen_nbt(buf,len);
SCVAL(buf,4,0xFF);
SCVAL(buf,5,'E');
SSVAL(buf,6,enc_ctx_num);
}
示例12: cli_lock64
BOOL cli_lock64(struct cli_state *cli, int fnum,
SMB_BIG_UINT offset, SMB_BIG_UINT len, int timeout, enum brl_type lock_type)
{
char *p;
int saved_timeout = cli->timeout;
int ltype;
if (! (cli->capabilities & CAP_LARGE_FILES)) {
return cli_lock(cli, fnum, offset, len, timeout, lock_type);
}
ltype = (lock_type == READ_LOCK? 1 : 0);
ltype |= LOCKING_ANDX_LARGE_FILES;
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0', smb_size);
set_message(cli->outbuf,8,0,True);
SCVAL(cli->outbuf,smb_com,SMBlockingX);
SSVAL(cli->outbuf,smb_tid,cli->cnum);
cli_setup_packet(cli);
SCVAL(cli->outbuf,smb_vwv0,0xFF);
SSVAL(cli->outbuf,smb_vwv2,fnum);
SCVAL(cli->outbuf,smb_vwv3,ltype);
SIVALS(cli->outbuf, smb_vwv4, timeout);
SSVAL(cli->outbuf,smb_vwv6,0);
SSVAL(cli->outbuf,smb_vwv7,1);
p = smb_buf(cli->outbuf);
SIVAL(p, 0, cli->pid);
SOFF_T_R(p, 4, offset);
SOFF_T_R(p, 12, len);
p += 20;
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (timeout != 0) {
cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout + 5*1000);
}
if (!cli_receive_smb(cli)) {
cli->timeout = saved_timeout;
return False;
}
cli->timeout = saved_timeout;
if (cli_is_error(cli)) {
return False;
}
return True;
}
示例13: cli_set_ea
static BOOL cli_set_ea(struct cli_state *cli, uint16 setup, char *param, unsigned int param_len,
const char *ea_name, const char *ea_val, size_t ea_len)
{
unsigned int data_len = 0;
char *data = NULL;
char *rparam=NULL, *rdata=NULL;
char *p;
size_t ea_namelen = strlen(ea_name);
if (ea_namelen == 0 && ea_len == 0) {
data_len = 4;
data = SMB_MALLOC(data_len);
if (!data) {
return False;
}
p = data;
SIVAL(p,0,data_len);
} else {
data_len = 4 + 4 + ea_namelen + 1 + ea_len;
data = SMB_MALLOC(data_len);
if (!data) {
return False;
}
p = data;
SIVAL(p,0,data_len);
p += 4;
SCVAL(p, 0, 0); /* EA flags. */
SCVAL(p, 1, ea_namelen);
SSVAL(p, 2, ea_len);
memcpy(p+4, ea_name, ea_namelen+1); /* Copy in the name. */
memcpy(p+4+ea_namelen+1, ea_val, ea_len);
}
if (!cli_send_trans(cli, SMBtrans2,
NULL, /* name */
-1, 0, /* fid, flags */
&setup, 1, 0, /* setup, length, max */
param, param_len, 2, /* param, length, max */
data, data_len, cli->max_xmit /* data, length, max */
)) {
return False;
}
if (!cli_receive_trans(cli, SMBtrans2,
&rparam, ¶m_len,
&rdata, &data_len)) {
return False;
}
SAFE_FREE(data);
SAFE_FREE(rdata);
SAFE_FREE(rparam);
return True;
}
示例14: push_ascii_nstring
size_t push_ascii_nstring(void *dest, const char *src)
{
size_t converted_size = 0;
bool ret = convert_string_error(CH_UNIX, CH_DOS, src, -1, dest, sizeof(nstring), &converted_size);
if (ret) {
SCVAL(dest, sizeof(nstring)-1, 0);
} else {
SCVAL(dest, 0, 0);
}
return ret ? converted_size : (size_t)-1;
}
示例15: cli_nt_create_full
int cli_nt_create_full(struct cli_state *cli, const char *fname,
uint32 CreatFlags, uint32 DesiredAccess,
uint32 FileAttributes, uint32 ShareAccess,
uint32 CreateDisposition, uint32 CreateOptions,
uint8 SecuityFlags)
{
char *p;
int len;
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf,24,0,True);
SCVAL(cli->outbuf,smb_com,SMBntcreateX);
SSVAL(cli->outbuf,smb_tid,cli->cnum);
cli_setup_packet(cli);
SSVAL(cli->outbuf,smb_vwv0,0xFF);
if (cli->use_oplocks)
CreatFlags |= (REQUEST_OPLOCK|REQUEST_BATCH_OPLOCK);
SIVAL(cli->outbuf,smb_ntcreate_Flags, CreatFlags);
SIVAL(cli->outbuf,smb_ntcreate_RootDirectoryFid, 0x0);
SIVAL(cli->outbuf,smb_ntcreate_DesiredAccess, DesiredAccess);
SIVAL(cli->outbuf,smb_ntcreate_FileAttributes, FileAttributes);
SIVAL(cli->outbuf,smb_ntcreate_ShareAccess, ShareAccess);
SIVAL(cli->outbuf,smb_ntcreate_CreateDisposition, CreateDisposition);
SIVAL(cli->outbuf,smb_ntcreate_CreateOptions, CreateOptions);
SIVAL(cli->outbuf,smb_ntcreate_ImpersonationLevel, 0x02);
SCVAL(cli->outbuf,smb_ntcreate_SecurityFlags, SecuityFlags);
p = smb_buf(cli->outbuf);
/* this alignment and termination is critical for netapp filers. Don't change */
p += clistr_align_out(cli, p, 0);
len = clistr_push(cli, p, fname, -1, 0);
p += len;
SSVAL(cli->outbuf,smb_ntcreate_NameLength, len);
/* sigh. this copes with broken netapp filer behaviour */
p += clistr_push(cli, p, "", -1, STR_TERMINATE);
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
return -1;
}
if (cli_is_error(cli)) {
return -1;
}
return SVAL(cli->inbuf,smb_vwv2 + 1);
}