Archive

Posts Tagged ‘Win32’

Create a dmp file from the application

October 25th, 2009 No comments
static LPTOP_LEVEL_EXCEPTION_FILTER m_previousFilter = NULL;


typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
                                         CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
                                         CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
                                         CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);

static LONG WINAPI MyUnhandledExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
{
    HMODULE hDll = ::LoadLibrary(_T("DBGHELP.DLL"));
    MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress(hDll, "MiniDumpWriteDump");

    _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
    ExInfo.ThreadId = ::GetCurrentThreadId();
    ExInfo.ExceptionPointers = pExceptionInfo;
    ExInfo.ClientPointers = NULL;

    MINIDUMP_CALLBACK_INFORMATION mci;

    // HANDLE hFile - minidamp file name(for example, "test.dmp")

    BOOL bOK = pDump(::GetCurrentProcess(), ::GetCurrentProcessId(),
                     hFile, 1, &ExInfo, NULL, &mci);
}


void main()
{
    // setup our own ExceptionHandler
    m_previousFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);

    // actial work

    // befoe exit
    if (m_previousFilter)
    {
        SetUnhandledExceptionFilter(m_previousFilter);
    }
}

Parallel Programming

October 22nd, 2009 No comments

77 Windows 7 Tips

October 9th, 2009 No comments

Windows 7 may be Microsoft’s most anticipated product ever. It builds on Windows Vista’s positives, and eliminates many of that OS’s negatives. It adds new functionality, too—all in a package that is less resource-hungry than its predecessor.

And whether or not you’re upgrading from Vista or skipping it altogether and moving up from Windows XP, you’ll need to know how to make the most of it in your environment. Here are 77 tips and tricks to get you there.

Intel Threading Building Blocks (TBB)

October 6th, 2009 No comments

Intel® Threading Building Blocks (Intel® TBB) is an award-winning C++ template library that abstracts threads to tasks to create reliable, portable, and scalable parallel applications. Just as the C++ Standard Template Library (STL) extends the core language, Intel TBB offers C++ users a higher level abstraction for parallelism. To implement Intel TBB, developers use familiar C++ templates and coding style, leaving low-level threading details to the library. It is also portable between architectures and operating systems. With Intel TBB, developers get the benefits of faster programming, scalable performance, and easier to maintain code.

Intel homepage

Intel® Threading Building Blocks 2.2 for Open Source

Parallel Pattern Library

October 5th, 2009 No comments

The new Parallel Pattern Library (PPL) enables you to express parallelism in your code and how the asynchronous messaging APIs can be used to separate shared state and increase your application’s resilience and robustness.

1. Four Ways to Use the Concurrency Runtime in Your C++ Projects

2. Concurrency Runtime

The Concurrency Runtime is a concurrent programming framework for C++. The Concurrency Runtime simplifies parallel programming and helps you write robust, scalable, and responsive parallel applications.

The features that the Concurrency Runtime provides are unified by a common work scheduler. This work scheduler implements a work-stealing algorithm that enables your application to scale as the number of available processors increases.

3. Parallel Programming in Native Code blog

OpenMP

October 4th, 2009 No comments

The OpenMP Application Program Interface (API) supports multi-platform shared-memory parallel programming in C/C++ and Fortran on all architectures, including Unix platforms and Windows NT platforms. Jointly defined by a group of major computer hardware and software vendors, OpenMP is a portable, scalable model that gives shared-memory parallel programmers a simple and flexible interface for developing parallel applications for platforms ranging from the desktop to the supercomputer.

OpenMP homepage

Additional:

Microsoft Application Verifier

September 29th, 2009 No comments

Application Verifier is designed specifically to detect and help debug memory corruptions and critical security vulnerabilities.

This is achieved by monitoring a native application’s interaction with the Windows operating system, profiling its use of objects, the registry, the file system, and Win32 APIs (including heaps, handles, locks, etc), and indicating issues when and where they are discovered.

Application Verifier also includes checks to predict how well an application may perform under various account privileges. These compatibility tests are used in Windows Logo program.

Print verification tests are also available to verify your usage of the print subsystem.

Download

Additional links:

VMMap

September 18th, 2009 No comments

VMMap is a process virtual and physical memory analysis utility. It shows a breakdown of a process’s committed virtual memory types as well as the amount of physical memory (working set) assigned by the operating system to those types. Besides graphical representations of memory usage, VMMap also shows summary information and a detailed process memory map. Powerful filtering and refresh capabilities allow you to identify the sources of process memory usage and the memory cost of application features.

Besides flexible views for analyzing live processes, VMMap supports the export of data in multiple forms, including a native format that preserves all the information so that you can load back in. It also includes command-line options that enable scripting scenarios.

VMMap is the ideal tool for developers wanting to understand and optimize their application’s memory resource usage.

Download VMMap

Run VMMap now from Live.Sysinternals.com

Using .NET Classes/Modules from native C++

September 17th, 2009 No comments

The goal of this article is to describe a more or less generic way to access .NET managed object from a native C++ application.

Introduction

The goal of this article is to describe a more or less generic way to access .NET managed object from a native C++ application. I will present a dynamic link library (dll) which can be used, for example, to augment legacy C++ applications with the power of managed code. The library is written in C++/CLI which is the only .NET language which can be used to accomplish such a task.
All code was written with Visual C++ 2008, it’s also possible to do this with previous versions of the Microsoft C++ compilers, but Microsoft has done a lot of changes to C++/CLI for VS 2008, so it’s now much easier to use than in older version.
The “more” generic in the first sentence means that the library can be used to call any function (with an unlimited amount of parameters) of any managed class. The “less” means that the parameter types are limited to the native C++ types and a few user defined types (string, date/time, …). It’s easy to provide support for your own types, but therefore the code for the dll has to be extended by yourself.

continue

Параллельное вычисление CRC32

September 17th, 2009 No comments

Автор: Александр Шарахов

Предлагаю вашему вниманию еще один подход к построению алгоритмов вычисления CRC32. Хотя многие использованные в нем идеи в той или иной мере содержатся в известных руководствах по оптимизации кода для IA32 и вычислению CRC32, он может представлять некоторый интерес. Использование свойств CRC-арифметики позволило разработать алгоритм вычисления CRC32, имеющий производительность в 3-5 раз выше стандартной табличной реализации. Например, на компьютере с процессором E6850/3.2GHz он расходует 1.33 такта процессора на байт, т.е. скорость обработки данных при вычислении CRC32 составляет 0.75 байта за такт центрального процессора или 2.4*10^9 байтов в секунду.

далее