小编mni*_*tic的帖子

可以指定IFileDialog的起始位置吗?

我在Microsoft文档中找不到任何内容,所以我只是想知道是否有人知道,是否可以指定一个起始位置IFileDialog?具体来说,我想第一次打开对话框,让它在父窗口的中心打开.

除了以某种方式挂钩底层WM_*消息之外,我没有看到一种直接的方式来做到这一点.

有可能使用类似的东西SetWindowPos吗?

windows winapi filedialog common-dialog

11
推荐指数
2
解决办法
699
查看次数

从 Windows 中的 PE 可执行文件中检索双重签名信息的修正代码?

我一直在努力修改来自 Microsoft 的此代码示例该示例显示(有些过时)如何从可执行文件中检索代码签名信息。它可以工作,但如果二进制文件是双重签名的,则它不会检索信息。

所以我做了一些研究并尝试重写它以使其识别 Windows 中许多现代可执行文件中存在的双重签名。不幸的是,很少有(模糊的)建议可用(1),(2),例如使用UnauthenticatedAttributesszOID_NESTED_SIGNATURE(无论这意味着什么)但仅用于检索时间戳的建议。

所以我试图重写那个微软代码,这是我得到的:

(要构建它,只需将其复制到 Visual Studio 控制台项目中并更改 .exe 文件路径。处理双重签名的代码在PrintDualSignatureInfo()函数中。)

#include "stdafx.h"

//SOURCE:
//      https://support.microsoft.com/en-us/help/323809/how-to-get-information-from-authenticode-signed-executables
//

#include <windows.h>
#include <wincrypt.h>
#include <wintrust.h>
#include <stdio.h>
#include <tchar.h>
#include <atlconv.h>

#pragma comment(lib, "crypt32.lib")

#define ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)

typedef struct {
    LPWSTR lpszProgramName;
    LPWSTR lpszPublisherLink;
    LPWSTR lpszMoreInfoLink;
} SPROG_PUBLISHERINFO, *PSPROG_PUBLISHERINFO;



BOOL GetProgAndPublisherInfo(PCMSG_SIGNER_INFO pSignerInfo,
                             PSPROG_PUBLISHERINFO Info);
BOOL GetDateOfTimeStamp(PCMSG_SIGNER_INFO pSignerInfo, SYSTEMTIME *st);
BOOL PrintCertificateInfo(PCCERT_CONTEXT pCertContext);
BOOL GetTimeStampSignerInfo(PCMSG_SIGNER_INFO …
Run Code Online (Sandbox Code Playgroud)

c++ winapi code-signing authenticode digital-signature

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

如何使用临界区

你好我想写一个有2个并发线程的程序。第一个线程写入数组字母“A”,第二个线程写入“B”。我的问题是如何使用关键部分通过仅包含字母 A 和仅包含字母 B 的交替数组获得结果?这是我的代码,但它不能正常工作。这有什么问题吗?

#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <psapi.h>
#define SIZE_TAB 200

volatile char program[SIZE_TAB];
CRITICAL_SECTION CriticalSection;
DWORD WINAPI aa(void *v);
DWORD WINAPI bb(void *v);

int main(int argc, char *argv[])
{
InitializeCriticalSection(&CriticalSection);

HANDLE thread_a = CreateThread(NULL, 0, aa, 0, 0, 0);
HANDLE thread_b = CreateThread(NULL, 0, bb, 0, 0, 0);

while (1)
{
    for (int i = 0; i<SIZE_TAB; i++)
        printf("%c", program[i]);
    Sleep(1000);
    printf("\n\n");
}

DeleteCriticalSection(&CriticalSection);

CloseHandle(thread_a);
CloseHandle(thread_b);
return 0;
}


 DWORD WINAPI aa(void *v)
 { …
Run Code Online (Sandbox Code Playgroud)

c winapi multithreading critical-section

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