28 #if !defined WIN32_LEAN_AND_MEAN
29 # define WIN32_LEAN_AND_MEAN
35 #include <osl/file.hxx>
36 #include <osl/security.hxx>
42 using namespace ::
osl;
43 using namespace ::
utl;
54 DWORD sz = MAX_COMPUTERNAME_LENGTH + 1;
55 TCHAR szHost[MAX_COMPUTERNAME_LENGTH + 1];
56 if (GetComputerNameA(szHost, &sz))
57 aHost = OString(szHost);
59 aHost = OString(
"UNKNOWN");
64 if ( gethostname( pHostName,
sizeof( pHostName ) - 1 ) == 0 )
66 pHostName[
sizeof( pHostName ) - 1] =
'\0';
67 aHost = OString( pHostName );
70 aHost = OString(
"UNKNOWN");
79 :m_bIPCserver(bIPCserver)
89 const int nIdBytes = 16;
90 char tmpId[nIdBytes*2+1];
91 time_t
t = time(
nullptr);
92 for (
int i = 0;
i<nIdBytes;
i++) {
94 sprintf( tmpId+
i*2,
"%02X", tmpByte );
96 tmpId[nIdBytes*2]=0x00;
97 m_aId = OUString::createFromAscii( tmpId );
100 char *tmpTime = ctime( &t );
101 if (tmpTime !=
nullptr) {
102 m_aDate = OUString::createFromAscii( tmpTime );
103 sal_Int32
i =
m_aDate.indexOf(
'\n');
111 if (aFile.open( osl_File_OpenFlag_Create ) == File::E_EXIST) {
127 (execWarning !=
nullptr && (*execWarning)(
this ))) {
131 (
void)aFile.open( osl_File_OpenFlag_Create );
153 Config aConfig(aLockname);
156 if (!aIPCserver.equalsIgnoreAsciiCase(
"true"))
164 if (aHost == myHost) {
168 aSecurity.getUserName( myUserName );
179 Config aConfig(aLockname);
186 aSecurity.getUserName( aUserName );
bool check(fpExecWarning execWarning)
static PathStatus locateUserInstallation(OUString &_rURL)
static OString impl_getHostname()
void SetGroup(const OString &rGroup)
Lockfile(bool bIPCserver=true)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
OString ReadKey(const OString &rKey) const
void WriteKey(const OString &rKey, const OString &rValue)
#define LOCKFILE_STAMPKEY
int uniform_int_distribution(int a, int b)
bool m_bDetectedRangeSegmentation false