Airbag client libraries should compile under MSVC .NET 2003/7.1 (#64).

r=bryner

http://groups.google.com/group/airbag-dev/browse_thread/thread/b838faeb50f71818


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@64 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2006-11-15 22:24:42 +00:00
parent 8647dde8cc
commit 73cd14b4af
10 changed files with 207 additions and 31 deletions

View file

@ -39,20 +39,14 @@
using std::wstring;
using google_airbag::PDBSourceLineWriter;
int main(int argc, char **argv) {
int wmain(int argc, wchar_t **argv) {
if (argc < 2) {
fprintf(stderr, "Usage: %s <pdb file>\n", argv[0]);
return 1;
}
wchar_t filename[_MAX_PATH];
if (mbstowcs_s(NULL, filename, argv[1], _MAX_PATH) == -1) {
fprintf(stderr, "invalid multibyte character in %s\n", argv[1]);
fprintf(stderr, "Usage: %ws <pdb file>\n", argv[0]);
return 1;
}
PDBSourceLineWriter writer;
if (!writer.Open(wstring(filename), PDBSourceLineWriter::ANY_FILE)) {
if (!writer.Open(wstring(argv[1]), PDBSourceLineWriter::ANY_FILE)) {
fprintf(stderr, "Open failed\n");
return 1;
}

View file

@ -183,6 +183,10 @@
RelativePath="..\..\..\common\windows\pdb_source_line_writer.h"
>
</File>
<File
RelativePath="..\..\..\common\windows\string_utils-inl.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"

View file

@ -46,6 +46,8 @@
#include <string>
#include <vector>
#include "common/windows/string_utils-inl.h"
#include "common/windows/http_upload.h"
#include "common/windows/pdb_source_line_writer.h"
@ -55,6 +57,7 @@ using std::vector;
using std::map;
using google_airbag::HTTPUpload;
using google_airbag::PDBSourceLineWriter;
using google_airbag::WindowsStringUtils;
// Extracts the file version information for the given filename,
// as a string, for example, "1.2.3.4". Returns true on success.
@ -82,12 +85,13 @@ static bool GetFileVersionString(const wchar_t *filename, wstring *version) {
wchar_t ver_string[24];
VS_FIXEDFILEINFO *file_info =
reinterpret_cast<VS_FIXEDFILEINFO*>(file_info_buffer);
_snwprintf_s(ver_string, sizeof(ver_string) / sizeof(wchar_t), _TRUNCATE,
L"%d.%d.%d.%d",
file_info->dwFileVersionMS >> 16,
file_info->dwFileVersionMS & 0xffff,
file_info->dwFileVersionLS >> 16,
file_info->dwFileVersionLS & 0xffff);
WindowsStringUtils::safe_swprintf(
ver_string, sizeof(ver_string) / sizeof(ver_string[0]),
L"%d.%d.%d.%d",
file_info->dwFileVersionMS >> 16,
file_info->dwFileVersionMS & 0xffff,
file_info->dwFileVersionLS >> 16,
file_info->dwFileVersionLS & 0xffff);
*version = ver_string;
return true;
}
@ -116,7 +120,13 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
}
FILE *temp_file = NULL;
#if _MSC_VER >= 1400 // MSVC 2005/8
if (_wfopen_s(&temp_file, temp_filename, L"w") != 0) {
#else // _MSC_VER >= 1400
// _wfopen_s was introduced in MSVC8. Use _wfopen for earlier environments.
// Don't use it with MSVC8 and later, because it's deprecated.
if (!(temp_file = _wfopen(temp_filename, L"w"))) {
#endif // _MSC_VER >= 1400
return false;
}
@ -148,8 +158,10 @@ int wmain(int argc, wchar_t *argv[]) {
}
wchar_t module_age_string[11];
_snwprintf_s(module_age_string, sizeof(module_age_string) / sizeof(wchar_t),
_TRUNCATE, L"0x%x", module_age);
WindowsStringUtils::safe_swprintf(
module_age_string,
sizeof(module_age_string) / sizeof(module_age_string[0]),
L"0x%x", module_age);
map<wstring, wstring> parameters;
parameters[L"module"] = module_basename;

View file

@ -188,6 +188,10 @@
RelativePath="..\..\..\common\windows\pdb_source_line_writer.h"
>
</File>
<File
RelativePath="..\..\..\common\windows\string_utils-inl.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"