Skip to content

Commit

Permalink
Merge pull request #23 from BarcaWebCloud/develop
Browse files Browse the repository at this point in the history
up v0.2.1
  • Loading branch information
ahsouza authored Apr 11, 2023
2 parents e65db26 + c4f9b3c commit 0221f91
Show file tree
Hide file tree
Showing 49 changed files with 19,765 additions and 63 deletions.
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,34 @@

# Changelog

## v0.2.0-BETA
## v0.2.1-BETA

### BScan

This is the latest version introduces the use of the module and its features.

<br>

## v0.2.1 [2023-04-10]

### Features

- [#23](https://github.com/BarcaWebCloud/bscan/pull/23): New features for windows. Gratitude @ahsouza!

### Bugs

- [#22](https://github.com/BarcaWebCloud/bscan/pull/22): New features for windows. Gratitude @ahsouza!


### Release Notes


Add features for **Windows** platform:

- **Get All Programs And Resources Installed**
- **Fixed bugs to methods OS on Windows platform**


<br>

## v0.2.0 [2023-04-05]
Expand Down
111 changes: 92 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
#
# Barca, Inc., Serra/ES, BRA | email: opensource@barca.com | GitHub: @BarcaWebCloud
# Barca, Inc., Vitória/ES, BRA | email: opensource@barca.com | GitHub: @BarcaWebCloud

cmake_minimum_required(VERSION 3.16)
project(bscan VERSION 0.2.0 DESCRIPTION "A library for collecting information about a computing device's Hardware & Software" HOMEPAGE_URL "https://store.barca.com/overview/modules/bscan" LANGUAGES CXX C)
project(bscan VERSION 0.2.1 DESCRIPTION "A library for collecting information about a computing device's Hardware & Software" HOMEPAGE_URL "https://store.barca.com/overview/modules/bscan" LANGUAGES CXX C)

message(STATUS "cmake version ${CMAKE_VERSION}\n\nproject: ${PROJECT_NAME}\nversion: ${PROJECT_VERSION}\ndescription: ${PROJECT_DESCRIPTION}\n${PROJECT_NAME}-api: https://api.bwc-${PROJECT_NAME}.com/v${PROJECT_VERSION_MAJOR}/")

Expand All @@ -34,7 +34,7 @@ if(UNIX)
elseif(WIN32)
# minimum version cmake on windows
cmake_minimum_required (VERSION 3.16)

EXECUTE_PROCESS(COMMAND wmic os get version
OUTPUT_VARIABLE OS_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down Expand Up @@ -64,8 +64,6 @@ elseif(WIN32)
elseif(CMAKE_GENERATOR STREQUAL "Borland Makefiles")
message("to do")
endif()

#set(CMAKE_GENERATOR_CC gcc)
set(CMAKE_CXX_FLAGS "-utf-8")
foreach(def IN ITEMS
-D_HAS_EXCEPTIONS=0
Expand All @@ -76,30 +74,103 @@ elseif(WIN32)
endforeach()

foreach(dir IN ITEMS
"$ENV{USERPROFILE}\\AppData\\Local\\Temp\\${PROJECT_NAME}jhkyo"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\readme.md"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\bin"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\cmd"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\cache"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\lib"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\logs"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\logs\\${PROJECT_VERSION}.log"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\etc"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\etc\\scripts"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\etc\\profile"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\etc\\ssh"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\storage"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\storage\\cache"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\storage\\${PROJECT_VERSION}.txt"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\storage\\db\\${PROJECT_VERSION}.db"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\settings"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\settings\\${PROJECT_VERSION}.default.conf"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\settings\\${PROJECT_VERSION}-preferences.conf"
"$ENV{USERPROFILE}\\.${PROJECT_NAME}"
"$ENV{USERPROFILE}\\.${PROJECT_NAME}\\win32"
"$ENV{USERPROFILE}\\.${PROJECT_NAME}\\win32\\v${PROJECT_VERSION}"
"$ENV{USERPROFILE}\\.${PROJECT_NAME}\\win32\\v${PROJECT_VERSION}\\bin"
"$ENV{USERPROFILE}\\.${PROJECT_NAME}\\win32\\v${PROJECT_VERSION}\\lib"
"$ENV{USERPROFILE}\\.${PROJECT_NAME}\\win32\\v${PROJECT_VERSION}\\www")
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\storage"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\storage\\mamutedb"
"$ENV{USERPROFILE}\\AppData\\Local\\Barca\\packages\\${PROJECT_NAME}\\${PROJECT_VERSION}\\data"
"$ENV{USERPROFILE}\\.bwc\\pkgs\\${PROJECT_NAME}"
"$ENV{USERPROFILE}\\.bwc\\pkgs\\${PROJECT_NAME}-v${PROJECT_VERSION}\\win32"
"$ENV{USERPROFILE}\\.bwc\\pkgs\\${PROJECT_NAME}-v${PROJECT_VERSION}\\win32\\cache"
"$ENV{USERPROFILE}\\.bwc\\pkgs\\${PROJECT_NAME}-v${PROJECT_VERSION}\\win32\\bin"
"$ENV{USERPROFILE}\\.bwc\\pkgs\\${PROJECT_NAME}-v${PROJECT_VERSION}\\win32\\lib"
"$ENV{USERPROFILE}\\.bwc\\pkgs\\${PROJECT_NAME}-v${PROJECT_VERSION}\\win32\\www")
if (EXISTS ${dir})
message(STATUS "directory exist")
else()
make_directory(${dir})
endif()
endforeach()
FILE(WRITE ${PROJECT_SOURCE_DIR}/include/bscan.config.h.in
"#ifndef CONFIG_H_IN\n"
"#define CONFIG_H_IN\n"
"#define PROJECT_NAME \"@PROJECT_NAME@\"\n"
"#define PROJECT_DESCRIPTION \"@PROJECT_DESCRIPTION@\"\n"
"#define PROJECT_VERSION \"@PROJECT_VERSION@\"\n"
"#define SYSTEM_PROCESSOR \"@CMAKE_SYSTEM_PROCESSOR@\"\n"
"#define GENERATOR \"@CMAKE_GENERATOR@\"\n"
"#define CXX_VERSION \"@CMAKE_CXX_STANDARD@\"\n"
"#define C_VERSION \"@CMAKE_C_STANDARD@\"\n"
"#define MINIMUM_VERSION \"@CMAKE_MINIMUM_REQUIRED_VERSION@\"\n"
"#define MINIMUM_VERSION \"@CMAKE_MINIMUM_REQUIRED_VERSION@\"\n"
"#define PROJECT_VERSION_MAJOR \"@PROJECT_VERSION_MAJOR@\"\n"
"#define URL_HOMEPAGE \"@HOMEPAGE_URL@\"\n"
"#define SOURCE_PROJECT \"@PROJECT_SOURCE_DIR@\"\n"
"#define SOURCE_BIN \"@CMAKE_CURRENT_BINARY_DIR@\"\n"
"#define PLATFORM_NAME \"@CMAKE_SYSTEM_NAME@\"\n"
"#define NINJA_OUTPUT_PATH_PREFIX \"@CMAKE_NINJA_OUTPUT_PATH_PREFIX@\"\n"
"#define TYPE_BUILD \"@CMAKE_BUILD_TYPE@\"\n"
"#endif // CONFIG_H_IN\n"
)

FILE(WRITE $ENV{USERPROFILE}/AppData/Local/Barca/packages/${PROJECT_NAME}/${PROJECT_VERSION}/etc/scripts/apps_installed.ps1
"function Analyze( $p, $f) {\n"
" Get-ItemProperty $p |foreach {\n"
" if (($_.DisplayName) -or ($_.version)) {\n"
" [PSCustomObject]@{\n"
" From = $f;\n"

" Name = $_.DisplayName;\n"

" Version = $_.DisplayVersion;\n"

" Date = $_.InstallDate;\n"

" UrlHelp = $_.HelpLink;\n"

" UrlAbout= $_.URLInfoAbout;\n"

" UrlUpdate = $_.URLUpdateInfo;\n"

" Company = $_.Publisher;\n"

" Phone = $_.HelpTelephone;\n"

" Contact = $_.Contact;\n"

" Location= $_.InstallLocation;\n"

" Origin= $_.InstallSource;\n"

" VersionMajor= $_.VersionMajor;\n"

" VersionMinor= $_.VersionMinor;\n"

" Uninstall= $_.UninstallString;\n"

" Size = $_.EstimatedSize;\n"

" Readme = $_.Readme;\n"
" }\n"
" }\n"
" }\n"
"}\n"
"$s = @()\n"
"$s += Analyze 'HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*' 64\n"
"$s += Analyze 'HKLM:\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*' 32\n"
"$s | Sort-Object -Property Name |Export-csv $ENV{TEMP}\\binstalrkop\n"
)

elseif(WINDOWS_PHONE)
# minimum version cmake on apple
Expand Down Expand Up @@ -159,7 +230,6 @@ elseif(XCODE)
message("BSCAN To ${CMAKE_SYSTEM_NAME}")
endif()


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand All @@ -169,12 +239,14 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")

configure_file ("include/bscan.config.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h @ONLY)
# check if header files exist in include directory
find_path(_check_include
NAMES
platform.h,
WMIwrapper.h,
bscan.h,
bscan.config.h.in,
dirent.h,
config.h,
sqlite3.h,
Expand All @@ -195,6 +267,7 @@ find_path(_check_include
"hwares/scan_ram.h",
# softwares header
"swares/swares.h",
"swares/scan_datasource.h",
"swares/scan_browser.h",
"swares/scan_os.h",
"swares/scan_system.h"
Expand Down
10 changes: 0 additions & 10 deletions include/config.h

This file was deleted.

4 changes: 4 additions & 0 deletions include/swares/scan_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#pragma once

#include <string>
#include <vector>

namespace bscan {

Expand Down Expand Up @@ -50,6 +51,7 @@ namespace bscan {
std::string imagessaved();
std::string images();
std::string historypowershell();
std::vector<std::string> programsandresources();
std::string pkgs();
std::string user();
std::string log();
Expand Down Expand Up @@ -82,6 +84,7 @@ namespace bscan {
static std::string getImagesSaved();
static std::string getImages();
static std::string getHistoryPowerShell();
static std::vector<std::string> getProgramsAndResources();
static std::string getPkgs();
static std::string getUser();
static std::string getLog();
Expand Down Expand Up @@ -115,6 +118,7 @@ namespace bscan {
std::string _imagessaved;
std::string _images;
std::string _historypowershell;
std::vector<std::string> _programsandresources;
std::string _pkgs;
std::string _user;
std::string _log;
Expand Down
Loading

0 comments on commit 0221f91

Please sign in to comment.