小编nim*_*son的帖子

应用程序无法正确启动 0xc0000142 CreateProcessWithLogonW

我有一段代码

if(!CreateProcessWithLogonW(
    szUserName,
    NULL,
    szPassword,
    LOGON_WITH_PROFILE,
    L"C:\\Windows\\System32\\cmd.exe", // file to execute
    NULL,              
    NORMAL_PRIORITY_CLASS | CREATE_BREAKAWAY_FROM_JOB,   // creation flags
    NULL,              // pointer to new environment block 
    NULL,              // name of current directory 
    &si,               // pointer to STARTUPINFO structure
    &pi                // receives information about new process
    )){
        ReportError(L"Create Process");
    }
Run Code Online (Sandbox Code Playgroud)

未调用 ReportError,但弹出 csrss.exe 启动错误

我究竟做错了什么?!

用户名和密码正确。

整个文件:

// cmd.cpp : Defines the entry point for the console application.
//

#include <Windows.h>
#include <Lmcons.h>
#include <iostream>
#include <ctype.h>
#include <string>
#include <stdio.h>

#define winstring …
Run Code Online (Sandbox Code Playgroud)

c++ winapi startup-error

6
推荐指数
1
解决办法
2938
查看次数

Brainfuck翻译行为不端

我正在为Brainfuck语言写一个翻译

我用了命令行

java bfinterpreter/BFInterpreter >output.bin
Run Code Online (Sandbox Code Playgroud)

bf程序应该以十六进制的形式输出00到FF,但它会推出

00 01 02 03 04 05 06 ... 7f 3f 3f 3f 3f 3f ... a0 a1 a2 ... ff
Run Code Online (Sandbox Code Playgroud)

其中...表示十六进制的+1序列

3f取代80到9f,我不明白为什么

资源:

package bfinterpreter;

/**
 *
 * @author Nicki von Bulow
 */
public class BFInterpreter {
private char[] program;
private StringBuilder output;
private byte[] input;
private short inputPosition;
private short[] data;
private short dataPosition;
private boolean debug;
private boolean valid;

public static final char INPUT = ',';
public static final char …
Run Code Online (Sandbox Code Playgroud)

java brainfuck

5
推荐指数
1
解决办法
358
查看次数

错误 C3017:OpenMP 'for' 语句中的终止测试形式不正确

我有一个定义了所有变量的 for 循环

#pragma omp parallel for
for(long long l = 1; l<=sqrtt; l++) ...
Run Code Online (Sandbox Code Playgroud)

当我使用/openmpVisual Studio 2012 中的命令行选项编译它时,它给了我

error C3017: termination test in OpenMP 'for' statement has improper form
Run Code Online (Sandbox Code Playgroud)

我不知道为什么'for' statement has improper form

什么是OpenMP的正确语句?如何将其应用于我的 for 循环?

c++ parallel-processing for-loop openmp visual-studio-2012

3
推荐指数
1
解决办法
4145
查看次数

C++ GetUserName()返回用户名和乱码

我想获取当前进程的用户名.我正在使用winapi标准GetUsername函数,如下所示:

TCHAR username[UNLEN + 1];
DWORD size = UNLEN + 1;
GetUserName((TCHAR*)username, &size);
Run Code Online (Sandbox Code Playgroud)

并像这样打印:

for(int i = 0; i <= UNLEN; i++) if(isalpha(username[i])) cout << (char)(username[i]);
Run Code Online (Sandbox Code Playgroud)

但它输出

Nickiê╕╕■scm +♣■pα┬p♠■≡î■MM♣■╧*■╔■♣ÿ(♣♣(♣♣♣♣T♣@♣3♣■┐

Nicki是我正在测试的系统的用户名.我不知道我做错了什么.编译很好,我包括在内

#include <Windows.h>
#include <Lmcons.h>
#include <iostream>
#include <ctype.h>
#include <string>
Run Code Online (Sandbox Code Playgroud)

这些标题.

有人可以帮忙!

c++ username windows-7

1
推荐指数
1
解决办法
2580
查看次数

gcc随身携带旋转

我想旋转一个字节(非常重要,它是8位).我知道Windows提供了一个函数_rotr8来完成这个任务.我想知道如何在Linux中执行此操作,因为我在那里移植程序.我问这个是因为我需要将位掩码为0.例如:

#define set_bit(byte,index,value) value ? \ //masking bit to 0 and one require different operators The index is used like so: 01234567 where each number is one bit
        byte |= _rotr8(0x80, index) : \ //mask bit to 1
        byte &= _rotr8(0x7F, index) //mask bit to 0
Run Code Online (Sandbox Code Playgroud)

第二项任务应说明8位进位旋转的重要性 (01111111 ror index)

c c++ bit-manipulation

0
推荐指数
1
解决办法
517
查看次数

为什么`else if(!var)`中的循环比`else`中的循环快?

我有两个块做同样的事情.

if(print) for(int i = 0; i < numt; i++) if(primes[i]) {
    printf("%d\n", i);
    numprimes++;
}
    //fast
else if(!print) for(int i = 0; i < numt; i++) if(primes[i]) {
    numprimes++;
}
Run Code Online (Sandbox Code Playgroud)

if(print) for(int i = 0; i < numt; i++) if(primes[i]) {
    printf("%d\n", i);
    numprimes++;
}
    //very slow
else for(int i = 0; i < numt; i++) if(primes[i]) {
    numprimes++;
}
Run Code Online (Sandbox Code Playgroud)

我估计第一个比第二个快一倍.为什么是这样?效果发生在多个编译器中(Mingw,msvc).print默认情况下为false,但您可以使用命令行args更改它.我在两种情况下都没有运行程序.这是一个真正的谜......

拆卸: 块1 块2

整个档案:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include …
Run Code Online (Sandbox Code Playgroud)

c++ loops for-loop

-4
推荐指数
1
解决办法
156
查看次数