Skip to content

Commit

Permalink
Merge pull request #3 from swiszczoo/develop
Browse files Browse the repository at this point in the history
Prepare to release 0.1.1
  • Loading branch information
swiszczoo committed Jan 1, 2022
2 parents 94e33cf + a748f3a commit 912ae3a
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 729 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Release 0.1.0
# CHANGELOG

## Release 0.1.1

This release is just a small fix of full names not appearing under some circumstances on some Windows machines.

**Fixes**:
- A bug that prevents user's full name from being properly read on some machines

## Release 0.1.0

This is the first version of Winpinator. It already supports
most of the planned features, however, it might be a little
Expand Down
4 changes: 2 additions & 2 deletions nsis/winpinator.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Section -StartMenu
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPrograms\$StartMenuDir"
CreateShortCut "$SMPROGRAMS\$StartMenuDir\${SOFTWARE_NAME} (${ARCH}).lnk" "$INSTDIR\Winpinator.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuDir\$(UNNAME).lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuDir\$(UNNAME) (${ARCH}).lnk" "$INSTDIR\uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Expand Down Expand Up @@ -357,7 +357,7 @@ SectionEnd

Section -un.StartMenu
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuDir
Delete "$SMPROGRAMS\$StartMenuDir\*.lnk"
Delete "$SMPROGRAMS\$StartMenuDir\*(${ARCH}).lnk"
RMDir "$SMPROGRAMS\$StartMenuDir"
SectionEnd

Expand Down
12 changes: 11 additions & 1 deletion res/to_copy/RELEASE NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Release 0.1.1
===============
This release is just a small fix of full names not appearing
under some circumstances on some Windows machines.

Fixes:
- A bug that prevents user's full name from being properly
read on some machines


Release 0.1.0
===============
This is the first version of Winpinator. It already supports
Expand All @@ -20,4 +30,4 @@ Features:
- Accept files to send as command line parameters and handle
usage of "Send to..." command in Windows Explorer
- Allow starting on system startup (can be turned off in
preferences)
preferences)
2 changes: 1 addition & 1 deletion src/gui/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const wxColour Utils::ORANGE_BACKGROUND = wxColour( 255, 217, 179 );
const wxColour Utils::RED_ACCENT = wxColour( 204, 0, 0 );
const wxColour Utils::RED_BACKGROUND = wxColour( 255, 190, 190 );

const wxString Utils::VERSION = "0.1.0";
const wxString Utils::VERSION = "0.1.1";

std::unique_ptr<Utils> Utils::s_inst = nullptr;

Expand Down
70 changes: 35 additions & 35 deletions src/proto-gen/warp.grpc.pb.cc

Large diffs are not rendered by default.

833 changes: 171 additions & 662 deletions src/proto-gen/warp.grpc.pb.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/service/remote_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void RemoteHandler::updateRemoteMachineInfo()
request->set_id( m_ident );
request->set_readable_name( Utils::getHostname() );

m_info->stub->experimental_async()->GetRemoteMachineInfo( ctx.get(),
m_info->stub->async()->GetRemoteMachineInfo( ctx.get(),
request.get(), response.get(),
[this, ctx, request, response]( grpc::Status status ) {
if ( status.ok() )
Expand Down Expand Up @@ -433,7 +433,7 @@ void RemoteHandler::updateRemoteMachineAvatar()
request->set_id( m_ident );
request->set_readable_name( Utils::getHostname() );

class Reader : public grpc::experimental::ClientReadReactor<RemoteMachineAvatar>
class Reader : public grpc::ClientReadReactor<RemoteMachineAvatar>
{
public:
Reader( RemoteInfoPtr info, std::function<void( RemoteInfoPtr )> edit )
Expand Down Expand Up @@ -509,7 +509,7 @@ void RemoteHandler::updateRemoteMachineAvatar()
responseReader->setInstance( responseReader );
responseReader->setRefs( ctx, request );

m_info->stub->experimental_async()->GetRemoteMachineAvatar( ctx.get(),
m_info->stub->async()->GetRemoteMachineAvatar( ctx.get(),
request.get(), responseReader.get() );

responseReader->start();
Expand All @@ -532,7 +532,7 @@ std::future<bool> RemoteHandler::waitForDuplex( int timeout )
std::shared_ptr<std::promise<bool>> result
= std::make_shared<std::promise<bool>>();

m_info->stub->experimental_async()->WaitingForDuplex( ctx.get(),
m_info->stub->async()->WaitingForDuplex( ctx.get(),
request.get(), response.get(),
[this, ctx, request, response, result]( grpc::Status status ) {
result->set_value( status.ok() );
Expand Down
80 changes: 68 additions & 12 deletions src/service/service_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <chrono>

#include <Windows.h>
#include <LM.h>

#define SECURITY_WIN32
#include <security.h>
Expand All @@ -25,22 +26,22 @@ std::string Utils::getHostname()

std::wstring Utils::getUserFullName()
{
ULONG size = 0;
GetUserNameExW( NameDisplay, NULL, &size );
std::wstring result;

if ( size == 0 )
result = Utils::getFullNameFromGetUserNameEx();
if ( !result.empty() )
{
return L"";
return result;
}

wchar_t* buffer = new wchar_t[size];
GetUserNameExW( NameDisplay, buffer, &size );

std::wstring result( buffer );

delete[] buffer;

return result;
result = Utils::getFullNameFromNetUserGetInfo();
if ( !result.empty() )
{
return result;
}

// Otherwise, fall back to short name
return Utils::getUserShortName();
}

std::wstring Utils::getUserShortName()
Expand Down Expand Up @@ -146,4 +147,59 @@ wxString Utils::makeIntResource( int resource )
return wxString::Format( "#%d", resource );
}

std::wstring Utils::getFullNameFromGetUserNameEx()
{
ULONG size = 0;
GetUserNameExW( NameDisplay, NULL, &size );

if ( size == 0 )
{
return L"";
}

wchar_t* buffer = new wchar_t[size];
buffer[0] = NULL;
GetUserNameExW( NameDisplay, buffer, &size );

std::wstring result( buffer );

delete[] buffer;

return result;
}

std::wstring Utils::getFullNameFromNetUserGetInfo()
{
ULONG size = 0;
GetUserNameExW( NameSamCompatible, NULL, &size );

if ( size == 0 )
{
return L"";
}

wchar_t* buffer = new wchar_t[size];
buffer[0] = NULL;
GetUserNameExW( NameSamCompatible, buffer, &size );

if ( !buffer[0] )
{
return L"";
}

LPUSER_INFO_10 p_ui10 = 0;
if ( NetUserGetInfo( NULL, buffer, 10, (LPBYTE*)&p_ui10 ) == NERR_Success )
{
std::wstring fullname = p_ui10->usri10_full_name;

NetApiBufferFree( p_ui10 );

return fullname;
}
else
{
return L"";
}
}

};
4 changes: 4 additions & 0 deletions src/service/service_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class Utils
static int64_t getMonotonicTime();

static wxString makeIntResource( int resource );

private:
static std::wstring getFullNameFromGetUserNameEx();
static std::wstring getFullNameFromNetUserGetInfo();
};

};
4 changes: 2 additions & 2 deletions src/service/transfer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ void TransferManager::processStartTransfer( const std::string& remoteId,

wxLogDebug( "TransferManager: starting transfer!" );

info->stub->experimental_async()->StartTransfer( ctx.get(), request.get(),
info->stub->async()->StartTransfer( ctx.get(), request.get(),
reactor.get() );
reactor->start();
}
Expand Down Expand Up @@ -1150,7 +1150,7 @@ void TransferManager::doSendRequestAfterCrawling( TransferOpPtr op,

if ( remote->stub )
{
remote->stub->experimental_async()->ProcessTransferOpRequest(
remote->stub->async()->ProcessTransferOpRequest(
ctx.get(), request.get(), response.get(),
[this, ctx, request, response]( grpc::Status status ) {

Expand Down
2 changes: 1 addition & 1 deletion src/service/transfer_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TransferManager

private:
class StartTransferReactor
: public grpc::experimental::ClientReadReactor<FileChunk>
: public grpc::ClientReadReactor<FileChunk>
{
public:
void setInstance( std::shared_ptr<StartTransferReactor> selfPtr );
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "winpinator",
"version-string": "0.1.0",
"version-string": "0.1.1",
"description": "An unofficial port of Warpinator from Linux Mint for Windows",
"dependencies": [
"cpp-base64",
Expand Down
12 changes: 6 additions & 6 deletions vs16/Winpinator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;Netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>$(ProjectDir)..\build\post_compile.bat "$(ProjectDir)..\res\to_copy" "$(OutDir)" "$(ProjectDir)..\src"</Command>
Expand All @@ -162,7 +162,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;Netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>$(ProjectDir)..\build\post_compile.bat "$(ProjectDir)..\res\to_copy" "$(OutDir)" "$(ProjectDir)..\src"</Command>
Expand All @@ -188,7 +188,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;Netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>$(ProjectDir)..\build\post_compile.bat "$(ProjectDir)..\res\to_copy" "$(OutDir)" "$(ProjectDir)..\src"</Command>
Expand All @@ -207,7 +207,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;Netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>$(ProjectDir)..\build\post_compile.bat "$(ProjectDir)..\res\to_copy" "$(OutDir)" "$(ProjectDir)..\src"</Command>
Expand All @@ -231,7 +231,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;Netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>$(ProjectDir)..\build\post_compile.bat "$(ProjectDir)..\res\to_copy" "$(OutDir)" "$(ProjectDir)..\src"</Command>
Expand All @@ -257,7 +257,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>WSock32.Lib;Iphlpapi.lib;ws2_32.lib;sensapi.lib;Secur32.lib;rpcrt4.lib;Netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>$(ProjectDir)..\build\post_compile.bat "$(ProjectDir)..\res\to_copy" "$(OutDir)" "$(ProjectDir)..\src"</Command>
Expand Down
2 changes: 1 addition & 1 deletion win32/manifest.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity
version="0.1.0.0"
version="0.1.1.0"
processorArchitecture="*"
name="Swiszczu.Winpinator"
type="win32"
Expand Down
Binary file modified win32/winpinator.rc
Binary file not shown.

0 comments on commit 912ae3a

Please sign in to comment.