小编Ser*_*gi0的帖子

WinHttp不会从WinXP上的Amazon S3下载

最近,亚马逊已禁用对S3存储桶的SSL支持,这似乎会导致Win XP SP3出现问题.我用这个代码

hSession = WinHttpOpen(L"MySession",
                    WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
                    WINHTTP_NO_PROXY_NAME,
                    WINHTTP_NO_PROXY_BYPASS, 0);


if (bHTTPS)
{
  DWORD flags = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1;
  WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, &flags, sizeof(flags));
}

port = bHTTPS ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
hConnect = WinHttpConnect(hSession, srv_w, port, 0);    
hRequest = WinHttpOpenRequest(hConnect, vrb_w, adr_w, NULL, WINHTTP_NO_REFERER, NULL,  WINHTTP_FLAG_REFRESH | (bHTTPS ? WINHTTP_FLAG_SECURE : 0));

if (bHTTPS)
{
  DWORD dwSecFlag = SECURITY_FLAG_IGNORE_CERT_CN_INVALID | 
                        SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | 
                        SECURITY_FLAG_IGNORE_UNKNOWN_CA | 
                        SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE;

  WinHttpSetOption(hRequest, WINHTTP_OPTION_SECURITY_FLAGS, &dwSecFlag, sizeof(dwSecFlag));
}

WinHttpSendRequest(hRequest, hdr_w, (headers != NULL) ? -1 : 0, data, size, size, …
Run Code Online (Sandbox Code Playgroud)

ssl winhttp amazon-s3 visual-c++

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

SHFileOperation 工作但打印错误消息

我正在使用 Shell API 复制包含文件的文件夹。

SHFILEOPSTRUCT sf = {0};
sf.wFunc = FO_COPY;
sf.hwnd = 0;
sf.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_SILENT | FOF_NO_UI;
sf.pFrom = "C:\\Users\\Sergi0\\AppData\\Local\\Temp\\untar.temp\\000\0";
sf.pTo = "F:\\\0";

// both pFrom and pTo are double NULL terminated, I have rechecked it

int err = SHFileOperation(&sf);
Run Code Online (Sandbox Code Playgroud)

一切正常,文件夹被复制到驱动器 F:问题是消息

internal\sdk\inc\wil\filesystem.h(820)\windows.storage.dll!7684045C: (caller: 7676413A) ReturnHr(2) tid(660) 80070057 Incorrect parameter.
...
internal\sdk\inc\wil\filesystem.h(820)\windows.storage.dll!7684045C: (caller: 7676413A) ReturnHr(101) tid(660) 80070057 Incorrect parameter.
Run Code Online (Sandbox Code Playgroud)

在 Visual Studio 调试控制台中打印。文件夹 000 中有 100 个文件,打印了 100 条消息。

我应该担心这些吗?我在 Windows 10 …

winapi shfileoperation c++14 visual-studio-2017

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

在WiX安装程序中无法显示对话框

我正在修改默认的FireBreath WiX脚本,以在安装完成后显示简单消息。因为有时它是如此之快,所以用户没有机会注意到它。

我有这个wxs文件

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" ">
        <Package ... />
        <Upgrade Id="{369b048a-9f97-5e15-8ce3-c983fa5764d3}">
            <UpgradeVersion
                Property="OLD_VERSION_FOUND"
                Minimum="0.0.1" IncludeMinimum="yes"
                Maximum="0.3.3.3" IncludeMaximum="yes"
                OnlyDetect="no" IgnoreRemoveFailure="yes"
                MigrateFeatures="yes" />
        </Upgrade>
        <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />
        <InstallExecuteSequence>
            <RemoveExistingProducts After="InstallInitialize" />
            <InstallExecute After="RemoveExistingProducts" />
        </InstallExecuteSequence>        

        <Directory Id="TARGETDIR" Name="SourceDir">
            ...
        </Directory>

        <Feature Id="MainPluginFeature" Title="Plugin" Level="1">
            <ComponentRef Id="InstallDirComp"/>
            <ComponentRef Id="PluginNameDirComp"/>
            <ComponentRef Id="CompanyDirComp"/>
            <ComponentGroupRef Id="PluginDLLGroup"/>
        </Feature>

      <UI>
        <Property Id="DefaultUIFont">DlgFont10</Property>
        <TextStyle Id="DlgFont10" FaceName="Tahoma" Size="10" />

        <Dialog Id="CompleteDlg"
            Width="370"
            Height="270"
            Title="Plugin installed">

          <Control Id="Description"
               Type="Text"
               X="50"
               Y="70"
               Width="220"
               Height="80"
               Text="Installation complete, …
Run Code Online (Sandbox Code Playgroud)

installer wix firebreath

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

sec:授权不起作用

最近,我开始了一个新项目,并决定使用最新版本的spring,spring security和thymeleaf,
我已将这些数据包包括在内

def springVersion = '4.1.6.RELEASE'
def securityVersion = '4.0.1.RELEASE'
def thymeleafVersion = '2.1.2.RELEASE'

compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework.security:spring-security-web:$securityVersion"
compile "org.springframework.security:spring-security-config:$securityVersion"

compile "org.thymeleaf:thymeleaf-spring4:$thymeleafVersion"
compile "org.thymeleaf.extras:thymeleaf-extras-springsecurity4:$thymeleafVersion"
Run Code Online (Sandbox Code Playgroud)

我已添加@EnableWebSecurity@Bean SpringSecurityDialect配置。
在layout.html中,我有

<ul class="nav navbar-nav navbar-right">
        <li sec:authorize="isAnonymous()"><a th:href="@{/login}">Login</a></li>
        <li sec:authorize="isAuthenticated()"><a th:href="@{/logout}">Logout</a></li>
    </ul>
<br>
Run Code Online (Sandbox Code Playgroud)

这两个选项均未显示。而且,当我用这些电话代替这些电话时true,不会有任何改变。当在函数名称中出错时,我看不到任何错误消息isAnon()。我想念什么吗?

UPD安全性配置

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

  @Autowired
  public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().withUser("admin").password("admin").roles("ADMIN");
  }

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http …
Run Code Online (Sandbox Code Playgroud)

spring-mvc spring-security thymeleaf

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