??????? ???? ?? ???? ?? ??? ????? ???? ??? ?????????? ?? ??????? ?????? ???? ?? ?? ???? Visual Studio 2005 ClickOnce ????????? ?? ?????? ???? ?? ?????? ???? ??? ?? ?????? ????? ??????? ????

???? ?????? ???? ??????
???? ID: 925521 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

?????

?? ?? ??????? ???? ?? ???? ?? ??? ????? ???? ??? ?????? ???? ?? ??????? ?????? ???? ?? ?? ?? Microsoft Visual Studio 2005 ClickOnce ????????? ?? ?????? ???? ?? ?????? ????, ???? ????? ?????? ????? ??????? ???? ??:
??????? ?? ????? ?? ??????? ?? ??? ???? ?????

????

?? ?????? ???? ?? ??????? ?????? ?????? ???? ?? ????? ?? ?? ??? ClickOnce ???? ???? ?? ???? ????? ?? ???? ClickOnce ????????? ???? ?? ???? ?? ??? ???? ?????????? ?? ??????? ?????? ?? ????? ???? ???? ?? ???? ??? ??? ????????? ?????? ???? ?????????? ?? ??????? ?????? ???? ?? ??? ??? ?????? ?? ?????????, ?? ??? ???? ????? ????? ????????? ??? ?????? ????? ?? ?????????? ??? ?????? ???? ?? ??? ???? ???? ??, ?? ???? "?????" ??? ??? ?????? ?????? ????? ??????? ???? ???

????????

?? ?????? ?? ?? ???? ?? ???, ????? ??? ?? ???? ?? ???? ????:.

?????? 1:

??????? ???????? ?? ???? ClickOnce ????????? Microsoft ?? ??? ??????? ?? ?????? .NET Framework 2.0 ?????? ??? 1 (SP1) ?? ?????? ????????

Windows Vista

.NET Framework 3.5 ?? .NET Framework 3.5 SP 1 ???? ?????

???:.NET Framework 3.5 ??? ?? ?? ???????? ?? .NET Framework 2.0 ?? incrementally ????? ?? 3.0 ??? .NET Framework 3.5 .NET Framework 2.0 SP1 ?? .NET Framework 3.0 SP1 ????? ????

????? ????? Microsoft ??????? ?????? ?? ??????? ?? ??? ?????? ??::

?? ??? ?? ??????? ?????? ??? ?? ??????? ????
??????? ????
.NET Framework 3.5 ?????? ?? ??????? ?????

?? ??? ?? ??????? ?????? ??? ?? ??????? ????
??????? ????
.NET Framework 3.5 ?????? ??? 1 ?????? ?? ??????? ?????

Microsoft ?????? ??????? ?? ???? ??????? ???? ?? ???? ??? ???? ????? ?? ???, ????? ???? ?????? ?? ????? ?? ???? ?? Microsoft ???????? ??? ?????::
119591?????? ?????? ?? Microsoft ?????? ??????? ???? ??????? ????
Microsoft ????? ?? ??? ?? ????? ?? ????? ?? ??? Microsoft ?? ?? ?????? ?? ?????? ???? ??????? ?????-??? ?????????? ?? ????? ???? ?? ????? ????? ?? ?? ??.. ????? ?? ???????-????????? ??????? ?? ???????? ?? ?? ????? ??? ??????? ??????? ?????????? ?? ????? ??? ??? ???? ???..

Windows XP

.NET Framework 2.0 SP1 ?? .NET Framework 2.0 ?????? ??? 2 (SP2) ?? ???? ?????

????? ??????? Microsoft ??????? ?????? ?? ??????? ?? ??? ?????? ???::

?? ??? ?? ??????? ?????? ??? ?? ??????? ????
??????? ????
.NET Framework 2.0 ?????? ??? 1 (x 86) ?????? ?? ??????? ?????

?? ??? ?? ??????? ?????? ??? ?? ??????? ????
??????? ????
.NET Framework 2.0 ?????? ??? 1 (x 64) ?????? ?? ??????? ?????

?? ??? ?? ??????? ?????? ??? ?? ??????? ????
??????? ????
.NET Framework 2.0 ?????? ??? 2 ?????? ?? ??????? ?????

Microsoft ?????? ??????? ?? ???? ??????? ???? ?? ???? ??? ???? ????? ?? ???, ????? ???? ?????? ?? ????? ?? ???? ?? Microsoft ???????? ??? ?????::
119591?????? ?????? ?? Microsoft ?????? ??????? ???? ??????? ????
Microsoft ????? ?? ??? ?? ????? ?? ????? ?? ??? Microsoft ?? ?? ?????? ?? ?????? ???? ??????? ?????-??? ?????????? ?? ????? ???? ?? ????? ????? ?? ?? ??.. ????? ?? ???????-????????? ??????? ?? ???????? ?? ?? ????? ??? ??????? ??????? ?????????? ?? ????? ??? ??? ???? ???..

???? 2

??????? ?????? ?????????? ?? ????? ?? ?? ??????????? ClickOnce ????????? ?? ??????? ???? ????? ???? ???, ?? ?????????? ?? ????? ???? ?? ?? ?????? ClickOnce ????????? ?? ???: ??????? ?????

???? 3

?? ?????????? ?????? ???????-?????? ??????? ?????? ??? ???? ?? ???, ????? ????? ?? ???? ????:.

Microsoft ???????????? ?????? ???? ???????? ?? ??? ??? ???? ??, ???? ??? ??? ?? ?????? ?? ?????????? ??? ??? ?????? ???? ?? ????.. ?????? ???????? ?????? ?? ???? ????? ???????? ?? ??? ???????? ????? ??? ?? ???? ?? ????? ???? ???.. ?? ??? ????? ?? ?? ?? ????? ?? ?? ??? ???????????? ???? ?? ?? ??????? ?? ?????? ??? ????? ????? ???????????? ?? ????? ?? ???? ???? ?? ??? ???? ?? ??? ??.. Microsoft ?????? ???????? ?? ????? ????????? ?? ???????????? ?? ?????? ??? ?????? ?? ???? ???.. ??, ?? ?? ???????? ?? ???? ??????? ?????????? ?? ?????? ???? ?? ??? ???????? ??????????????? ?? ?????? ?? ???????????? ????? ?? ??? ??????? ???? ??????..
  1. Visual Studio 2005, ??? ????? ???????????? ????????????, ?? ???? ????????????.
  2. ????? ????,????? C++????? ????,Win32 ????? ???????????????:RenewCert????????????? ???, ?? ???? ???OK.
  3. ?????Win32 ????????? ???????????? ????? ???, ????? ??????????.
  4. RenewCert.cpp ????? ??? ????? ??? ?? ????? ??? ?? ?????:
    #include "stdafx.h"
    
    void ReadPFXFile(LPCWSTR fileName, CRYPT_DATA_BLOB *pPFX)
    
    {
    
                HANDLE hCertFile = NULL;
    
                DWORD cbRead = 0;
    
                DWORD dwFileSize = 0, dwFileSizeHi = 0;
    
                hCertFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    
                dwFileSize = GetFileSize(hCertFile, &dwFileSizeHi);
    
                pPFX->pbData = (BYTE *) CryptMemAlloc(dwFileSize*sizeof(BYTE));
    
                pPFX->cbData = dwFileSize;
    
                ReadFile(hCertFile, pPFX->pbData, pPFX->cbData, &cbRead, NULL);
    
                CloseHandle(hCertFile);
    
    }
    
    void GetPrivateKey(CRYPT_DATA_BLOB pPFX, LPCWSTR szPassword, HCRYPTPROV *hCPContext)
    
    {
    
                HCERTSTORE hCertStore = NULL;
    
                PCCERT_CONTEXT hCertContext = NULL;
    
                DWORD dwKeySpec = AT_SIGNATURE;
    
                BOOL bFreeCertKey = TRUE;
    
                hCertStore = PFXImportCertStore(&pPFX, szPassword, CRYPT_EXPORTABLE);
    
                hCertContext = CertEnumCertificatesInStore(hCertStore, NULL);
    
                CryptAcquireCertificatePrivateKey(hCertContext, 0, NULL, hCPContext, &dwKeySpec, &bFreeCertKey);
    
                CertCloseStore(hCertStore, CERT_CLOSE_STORE_FORCE_FLAG);
    
    }
    
    void PrintContainerName(HCRYPTPROV hCPContext)
    
    {
    
                DWORD containerNameLen = 0;
    
                CHAR *szContainerName = NULL;
    
                CryptGetProvParam(hCPContext, PP_CONTAINER, NULL, &containerNameLen, 0);
    
                szContainerName = (CHAR *)CryptMemAlloc(sizeof(BYTE)*containerNameLen);
    
                CryptGetProvParam(hCPContext, PP_CONTAINER, (BYTE *)szContainerName, &containerNameLen, 0);
    
                printf("This certificate's container name is: %s", szContainerName);
    
    }
    
    void MakeNewCert(HCRYPTPROV hCPContext, LPCWSTR szCertName, LPCWSTR szPassword, CRYPT_DATA_BLOB *pPFX)
    
    {
    
                CERT_NAME_BLOB certNameBlob = {0,NULL};
    
                PCCERT_CONTEXT hCertContext = NULL;
    
                SYSTEMTIME certExpireDate;
    
                HCERTSTORE hTempStore = NULL;
    
                CertStrToName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, szCertName, CERT_OID_NAME_STR, NULL, NULL, &certNameBlob.cbData, NULL);
    
                certNameBlob.pbData = (BYTE *)CryptMemAlloc(sizeof(BYTE)*certNameBlob.cbData);
    
                CertStrToName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, szCertName, CERT_OID_NAME_STR, NULL, certNameBlob.pbData, &certNameBlob.cbData, NULL);
    
                GetSystemTime(&certExpireDate);
    
                certExpireDate.wYear += 5;
    
                hCertContext = CertCreateSelfSignCertificate(hCPContext, &certNameBlob, 0, NULL, NULL, NULL, &certExpireDate, NULL);
    
                hTempStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, CERT_STORE_CREATE_NEW_FLAG, 0);
    
                CertAddCertificateContextToStore(hTempStore, hCertContext, CERT_STORE_ADD_NEW, NULL);
    
                PFXExportCertStoreEx(hTempStore, pPFX, szPassword, NULL, EXPORT_PRIVATE_KEYS);
    
                pPFX->pbData = (BYTE *)CryptMemAlloc(sizeof(BYTE)*pPFX->cbData);
    
                PFXExportCertStoreEx(hTempStore, pPFX, szPassword, NULL, EXPORT_PRIVATE_KEYS);
    
                CryptMemFree(certNameBlob.pbData);
    
                CertCloseStore(hTempStore, CERT_CLOSE_STORE_FORCE_FLAG);
    
                CertFreeCertificateContext(hCertContext);
    
    }
    
    void WritePFX(CRYPT_DATA_BLOB pPFX, LPCWSTR szOutputFile)
    
    {
    
                HANDLE hOutputFile = NULL;
    
                DWORD cbWritten = 0;
    
                hOutputFile = CreateFile(szOutputFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
    
                WriteFile(hOutputFile, pPFX.pbData, pPFX.cbData, &cbWritten, NULL);
    
                CloseHandle(hOutputFile);
    
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    
    {
    
                LPCWSTR szCertFileName = NULL;
    
                CRYPT_DATA_BLOB pPFX;
    
                LPCWSTR szPassword = NULL;
    
                HCRYPTPROV hCPContext = NULL;
    
                LPCWSTR szCertName = L"CN=NewCert";
    
                CRYPT_DATA_BLOB pPfxOutputBlob = {0,NULL};
    
                LPCWSTR szOutFile = NULL;
    
                // Parse the command line.
    
                if(argc == 1)
    
                {
    
                            printf("renewcert <PFX File> <new cert filename> <new cert friendly name> [optional]<password>\n");
    
                            printf("Example: renewcert oldcert.pfx newcert.pfx \"CN=MyNewCert\" MySuperSecretPassword");
    
                            return 0;
    
                }
    
                if(argc >= 2)
    
                            szCertFileName = argv[1];
    
                if(argc >= 5)
    
                            szPassword = argv[4];
    
                // Uncomment this block to add <new cert filename> and <new cert friendly name> as parameters
    
                // NOTE: <new cert friendly name> must be of format "CN=<name>"
    
                if(argc >= 3)
    
                            szOutFile = argv[2];
    
                if(argc >= 4)
    
                            szCertName = argv[3];
    
                ReadPFXFile(szCertFileName, &pPFX);
    
                GetPrivateKey(pPFX, szPassword, &hCPContext);
    
                //PrintContainerName(hCPContext);
    
                // Uncomment this section to make a new PFX rather than just printing the container name.
    
                // Make sure you also uncomment the command line parameter section above.
    
                MakeNewCert(hCPContext, szCertName, szPassword, &pPfxOutputBlob);
    
                WritePFX(pPfxOutputBlob, szOutFile);
    
                // Clean up.
    
                CryptReleaseContext(hCPContext, 0);
    
                CryptMemFree(pPfxOutputBlob.pbData);
    
                CryptMemFree(pPFX.pbData);
    
                return 0;
    
    }
    
  5. Stdafx.h ????? ??? ????? ??? ?? ????? ??? ?? ?????:
    // stdafx.h : include file for standard system include files,
    
    // or project specific include files that are used frequently, but
    
    // are changed infrequently.
    
    //
    
    #pragma once
    
    #define WIN32_LEAN_AND_MEAN                     // Exclude rarely used material from Windows headers.
    
    #include <stdio.h>
    
    #include <tchar.h>
    
    #include <windows.h>
    
    #include <wincrypt.h>
    
  6. ????? ????????????????? ??,????? ????????? ?? ??? ??? ??? ????? ???
  7. ??????? ????Linker???, ?? ???? ????????.
  8. ????? ?? ???? ?? ????? ???? ????? ???????????? ??????????, ?? ???? ??? ellipsis ??? (????? ????...) ?? ??? ????? ?? ??????????? ??????????????? ????? ?? ??????? ?? ??? ?? ..
  9. ????? ????? ??, ??? ?????Crypt32.lib?? ????-????? ????, ?? ???? ???OK.
  10. ????? ????,???? ?????? ????-????? ????, ?? ???? ???OK??? ????? ??? ?????
  11. ????? ????????????? ??,?????? ?????.
  12. ?????? ????? ??, ?? ??? ?????????? ?? ?????? ???? ?? ??? ????? ???? ?????????:
    renewcert <OldCertificate>.pfx <NewCertificate>.pfx \"CN=<NewCertificateName>\" <Password>
    ???: <oldcertificate></oldcertificate>?????? ?????????? ?? ??? ?? ??????????? ??<newcertificate></newcertificate>?? ?????????? ?? ??? ?? ??????????? ??<newcertificatename></newcertificatename>?? ?????????? ?? ??? ?? ??? ?? ??????????? ?? ??<password></password>??????? ?? ??? ?? ??????????? ???

???? ???????

?? ?????? ?? ???: ??????? ???? ?? ??? ???

  1. Visual Studio 2005 ??????? ?????
  2. ????? ???????????? ??,????? ????-????? ????, ?? ???? ????????????.
  3. ????? ????,????? C#????? ????,Windows ???????????????:WindowsApplication1????????????? ???, ?? ???? ???OK.
  4. ?????? Explorer ???, ???? ?????WindowsApplication1?? ????-????? ????, ?? ???? ??????.
  5. ????? ????,?????????, ?? ???? ??? ?? ????? ?? ??? ???? ?????? ?????? ???? ?? ????? ?????
  6. ?????? Explorer ???, ???? ?????WindowsApplication1?? ????-????? ????, ?? ???? ??????????? ????. ???????? ??????? ??????? ?? ???? ???
  7. ????? ???????? ?? ????? ??? ????????? ???????? ???? ?? ???????? ??? ????? URL ?????, ?? ???? ??? ????? ????next. URL ?? ??? ????? ?????? ?? ????? ????:
    HTTP://Servername/FolderName
  8. ????? ????????????? ?????? ????? ????????????? ??, ??????? ?????? ????? ?????

    ???
    • ??? ?? ?????????? ?? ?????????? ??????? ?? ?????????? ???? ??? ??, ?? ????????? ?? ????? ?? ?????? ?????? ???? ????? ???, ????? ???????, ?? ????????? ?????? ????? ?????? ?? ??????. ??????? ?? ????????? ?? ??? ??????? ????? ????????????? ??..
    • ??? ?? ????????? ?? publish ????? ?? ????? ????? ???, ????? ????????, ?? ????????? ???? ?????? ?????? ??. ?? ?? ???????? ??? ??????? ???? ?????????????? ??..
  9. ????? ????,next???? ???? ?? ????
  10. ????? ????,??????????????? ???????? ???? ?? ????
  11. Http:// ?? ClickOnce ????????? ??????? ????Servername/FolderNameURL /publish.htm ???
  12. ???? ?? ??? ?????????? ?? ??????? ?????? ???? ??, ?? ??? 6 ??? 10 ????????? ????????????? ???? ???? ?? ??? ????????
  13. Http:// ?? ClickOnce ????????? ?????? ?? ??????? ???? ?? ?????? ????Servername/FolderNameURL /publish.htm ???

???

???? ID: 925521 - ????? ???????: 06 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
??????: 
kbtshoot kberrmsg kbbug kbprb kbmt KB925521 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:925521

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com