Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ned14/ntkernel-error-category.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2017-07-30 22:12:21 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2017-07-30 22:12:21 +0300
commit109880d7f02d0de1fc2726d6cc675718be6ab492 (patch)
tree4e710f8c60c0a2f24bef2c8c1a2a4e83d0cf7bff
parent145e45b8288558acd270fdf1f35739408467f9a7 (diff)
updated to latest static-viewsstatic-views-test
m---------static-views0
-rw-r--r--test/static-view.cpp69
2 files changed, 29 insertions, 40 deletions
diff --git a/static-views b/static-views
-Subproject f00c963459c5d90d60f7f8b97c7001dc63207a0
+Subproject 8ab6386deb22e2ffafa6be6fe27487782d09089
diff --git a/test/static-view.cpp b/test/static-view.cpp
index 2628fc7..32df829 100644
--- a/test/static-view.cpp
+++ b/test/static-view.cpp
@@ -25,7 +25,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#include "../static-views/example/static_map.hpp"
#include "ntkernel_category.hpp"
-#include <iostream>
+#include <stdio.h>
#include <string.h>
#ifdef _WIN32
@@ -37,51 +37,40 @@ static constexpr field table[] = {
#include "../include/detail/ntkernel-table.ipp"
};
-int main()
+int main(int argc, char *argv[])
{
using namespace ntkernel_error_category;
int retcode = 0;
constexpr size_t table_size = sizeof(table) / sizeof(table[0]);
- constexpr auto posix_to_ntstatus_map = //
- boost::static_views::static_map::make_static_map<1, table_size>( //
- boost::static_views::raw_view(table), //
- &field::posix, //
- &field::ntstatus //
- );
- constexpr auto ntstatus_to_posix_map = //
- boost::static_views::static_map::make_static_map<1, table_size>( //
- boost::static_views::raw_view(table), //
- &field::ntstatus, //
- &field::posix //
- );
- constexpr auto ntstatus_to_message_map = //
- boost::static_views::static_map::make_static_map<1, table_size>( //
- boost::static_views::raw_view(table), //
- &field::ntstatus, //
- &field::message //
- );
- std::cout << "The following NTSTATUS codes are mapped by these POSIX codes:\n";
+ constexpr auto posix_to_ntstatus_map = //
+ boost::static_views::static_map::make_static_map<128, table_size>( //
+ boost::static_views::raw_view(table), //
+ &field::posix, //
+ &field::ntstatus //
+ );
+ constexpr auto ntstatus_to_posix_map = //
+ boost::static_views::static_map::make_static_map<2 * table_size, 2>( //
+ boost::static_views::raw_view(table), //
+ &field::ntstatus, //
+ &field::posix //
+ );
+ constexpr auto ntstatus_to_message_map = //
+ boost::static_views::static_map::make_static_map<2 * table_size, 2>( //
+ boost::static_views::raw_view(table), //
+ &field::ntstatus, //
+ &field::message //
+ );
+ printf("The following NTSTATUS codes are mapped by these POSIX codes:\n");
{
- static constexpr int values[] = {
- posix_to_ntstatus_map[EACCES],
- posix_to_ntstatus_map[EAGAIN],
- posix_to_ntstatus_map[EBUSY],
- posix_to_ntstatus_map[ENOSYS],
- posix_to_ntstatus_map[EINVAL],
- posix_to_ntstatus_map[ENOENT],
- posix_to_ntstatus_map[ENOMEM],
- posix_to_ntstatus_map[EEXIST],
- posix_to_ntstatus_map[ENOLCK],
- posix_to_ntstatus_map[ENOSPC],
- posix_to_ntstatus_map[ENODEV],
- posix_to_ntstatus_map[EXDEV],
- posix_to_ntstatus_map[ENOTEMPTY],
- posix_to_ntstatus_map[EMFILE],
- posix_to_ntstatus_map[ECANCELED]
- };
- for(auto &v : values)
- std::cout << " " << std::hex << v << std::dec << "(" << ntstatus_to_message_map[v] << ")" << "\n";
+ static constexpr int values[] = {posix_to_ntstatus_map[EACCES], posix_to_ntstatus_map[EAGAIN], posix_to_ntstatus_map[EBUSY], posix_to_ntstatus_map[ENOSYS], posix_to_ntstatus_map[EINVAL], posix_to_ntstatus_map[ENOENT], posix_to_ntstatus_map[ENOMEM], posix_to_ntstatus_map[EEXIST],
+ posix_to_ntstatus_map[ENOLCK], posix_to_ntstatus_map[ENOSPC], posix_to_ntstatus_map[ENODEV], posix_to_ntstatus_map[EXDEV], posix_to_ntstatus_map[ENOTEMPTY], posix_to_ntstatus_map[EMFILE], posix_to_ntstatus_map[ECANCELED]};
+ printf(" %x (%s)\n", values[0], ntstatus_to_message_map[values[0]]);
+ printf(" %x (%s)\n", values[1], ntstatus_to_message_map[values[1]]);
+ printf(" %x (%s)\n", values[2], ntstatus_to_message_map[values[2]]);
+ printf(" %x (%s)\n", values[3], ntstatus_to_message_map[values[3]]);
+ printf(" %x (%s)\n", values[4], ntstatus_to_message_map[values[4]]);
+ printf(" %x (%s)\n", values[argc], ntstatus_to_message_map[values[argc]]);
}
return retcode;
} \ No newline at end of file